25 #include <queso/SequenceOfVectors.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
32 template <
class V,
class M>
35 unsigned int subSequenceSize,
36 const std::string& name)
39 m_seq (subSequenceSize,NULL)
40 #ifdef UQ_CODE_HAS_MONITORS
42 m_subMeanMonitorPosSeq (NULL),
43 m_subMeanVecSeq (NULL),
44 m_subMeanCltStdSeq (NULL),
45 m_subMeanInter0MonitorPosSeq (NULL),
46 m_subMeanInter0Mean (NULL),
47 m_subMeanInter0Clt95 (NULL),
48 m_subMeanInter0Empirical90 (NULL),
49 m_subMeanInter0Min (NULL),
50 m_subMeanInter0Max (NULL),
51 m_unifiedMeanMonitorPosSeq (NULL),
52 m_unifiedMeanVecSeq (NULL),
53 m_unifiedMeanCltStdSeq (NULL)
67 template <
class V,
class M>
70 #ifdef UQ_CODE_HAS_MONITORS
71 if (m_subMeanMonitorPosSeq)
delete m_subMeanMonitorPosSeq;
72 if (m_subMeanVecSeq )
delete m_subMeanVecSeq;
73 if (m_subMeanCltStdSeq )
delete m_subMeanCltStdSeq;
75 if (m_subMeanInter0MonitorPosSeq)
delete m_subMeanInter0MonitorPosSeq;
76 if (m_subMeanInter0Mean )
delete m_subMeanInter0Mean;
77 if (m_subMeanInter0Clt95 )
delete m_subMeanInter0Clt95;
78 if (m_subMeanInter0Empirical90 )
delete m_subMeanInter0Empirical90;
79 if (m_subMeanInter0Min )
delete m_subMeanInter0Min;
80 if (m_subMeanInter0Max )
delete m_subMeanInter0Max;
82 if (m_unifiedMeanMonitorPosSeq)
delete m_unifiedMeanMonitorPosSeq;
83 if (m_unifiedMeanVecSeq )
delete m_unifiedMeanVecSeq;
84 if (m_unifiedMeanCltStdSeq )
delete m_unifiedMeanCltStdSeq;
87 for (
unsigned int i = 0; i < (
unsigned int) m_seq.size(); ++i) {
88 if (m_seq[i])
delete m_seq[i];
92 template <
class V,
class M>
93 SequenceOfVectors<V,M>&
101 template <
class V,
class M>
108 template <
class V,
class M>
112 if (newSubSequenceSize != this->subSequenceSize()) {
113 if (newSubSequenceSize < this->subSequenceSize()) {
114 this->resetValues(newSubSequenceSize,this->subSequenceSize()-newSubSequenceSize);
116 m_seq.resize(newSubSequenceSize,NULL);
117 std::vector<const V*>(m_seq).swap(m_seq);
124 template <
class V,
class M>
128 bool bRC = ((initialPos < this->subSequenceSize()) &&
130 ((initialPos+numPos) <= this->subSequenceSize()));
131 if ((bRC ==
false) && (m_env.subDisplayFile())) {
132 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::resetValues()"
133 <<
", initialPos = " << initialPos
134 <<
", this->subSequenceSize() = " << this->subSequenceSize()
135 <<
", numPos = " << numPos
138 queso_require_msg(bRC,
"invalid input data");
140 for (
unsigned int j = 0; j < numPos; ++j) {
141 if (m_seq[initialPos+j] != NULL) {
142 delete m_seq[initialPos+j];
143 m_seq[initialPos+j] = NULL;
152 template <
class V,
class M>
156 bool bRC = ((initialPos < this->subSequenceSize()) &&
158 ((initialPos+numPos) <= this->subSequenceSize()));
159 queso_require_msg(bRC,
"invalid input data");
161 for (
unsigned int j = 0; j < numPos; ++j) {
162 if (m_seq[initialPos+j] != NULL) {
163 delete m_seq[initialPos+j];
164 m_seq[initialPos+j] = NULL;
169 if (initialPos < this->subSequenceSize()) std::advance(posIteratorBegin,initialPos);
170 else posIteratorBegin = m_seq.end();
172 unsigned int posEnd = initialPos + numPos;
174 if (posEnd < this->subSequenceSize()) std::advance(posIteratorEnd,posEnd);
175 else posIteratorEnd = m_seq.end();
177 unsigned int oldSubSequenceSize = this->subSequenceSize();
178 m_seq.erase(posIteratorBegin,posIteratorEnd);
179 queso_require_equal_to_msg((oldSubSequenceSize - numPos), this->subSequenceSize(),
"(oldSubSequenceSize - numPos) != this->subSequenceSize()");
186 template <
class V,
class M>
190 queso_require_less_msg(posId, this->subSequenceSize(),
"posId > subSequenceSize()");
192 queso_require_msg(m_seq[posId],
"posId is NULL");
199 vec = *(m_seq[posId]);
204 template <
class V,
class M>
208 queso_require_less_msg(posId, this->subSequenceSize(),
"posId > subSequenceSize()");
212 if (m_seq[posId] != NULL)
delete m_seq[posId];
213 m_seq[posId] =
new V(vec);
225 template <
class V,
class M>
228 const V& numEvaluationPointsVec,
232 V minDomainValues(m_vectorSpace.zeroVector());
233 V maxDomainValues(m_vectorSpace.zeroVector());
237 unsigned int numParams = this->vectorSizeLocal();
238 for (
unsigned int i = 0; i < numParams; ++i) {
239 this->extractScalarSeq(0,
245 std::vector<double> aCdf(0);
246 data.subUniformlySampledCdf((
unsigned int) numEvaluationPointsVec[i],
260 template <
class V,
class M>
263 const V& numEvaluationPointsVec,
267 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 10)) {
268 *m_env.subDisplayFile() <<
"Entering SequenceOfVectors<V,M>::unifiedUniformlySampledCdf()"
272 V unifiedMinDomainValues(m_vectorSpace.zeroVector());
273 V unifiedMaxDomainValues(m_vectorSpace.zeroVector());
277 unsigned int numParams = this->vectorSizeLocal();
278 for (
unsigned int i = 0; i < numParams; ++i) {
279 this->extractScalarSeq(0,
285 std::vector<double> aCdf(0);
286 data.unifiedUniformlySampledCdf(m_vectorSpace.numOfProcsForStorage() == 1,
287 (
unsigned int) numEvaluationPointsVec[i],
288 unifiedMinDomainValues[i],
289 unifiedMaxDomainValues[i],
295 unifiedMinDomainValues,
296 unifiedMaxDomainValues);
298 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 10)) {
299 *m_env.subDisplayFile() <<
"Leaving SequenceOfVectors<V,M>::unifiedUniformlySampledCdf()"
306 template <
class V,
class M>
309 unsigned int initialPos,
313 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
314 *m_env.subDisplayFile() <<
"Entering SequenceOfVectors<V,M>::subMeanExtra()"
315 <<
": initialPos = " << initialPos
316 <<
", numPos = " << numPos
317 <<
", sub sequence size = " << this->subSequenceSize()
321 bool bRC = ((initialPos < this->subSequenceSize()) &&
323 ((initialPos+numPos) <= this->subSequenceSize()) &&
324 (this->vectorSizeLocal() == meanVec.sizeLocal() ));
325 if ((bRC ==
false) && (m_env.subDisplayFile())) {
326 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::subMeanExtra()"
327 <<
", initialPos = " << initialPos
328 <<
", this->subSequenceSize() = " << this->subSequenceSize()
329 <<
", numPos = " << numPos
330 <<
", this->vectorSizeLocal() = " << this->vectorSizeLocal()
331 <<
", meanVec.sizeLocal() = " << meanVec.sizeLocal()
334 queso_require_msg(bRC,
"invalid input data");
338 unsigned int numParams = this->vectorSizeLocal();
339 for (
unsigned int i = 0; i < numParams; ++i) {
340 this->extractScalarSeq(initialPos,
349 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
350 *m_env.subDisplayFile() <<
"Leaving SequenceOfVectors<V,M>::subMeanExtra()"
351 <<
": initialPos = " << initialPos
352 <<
", numPos = " << numPos
353 <<
", sub sequence size = " << this->subSequenceSize()
354 <<
", meanVec = " << meanVec
361 template <
class V,
class M>
364 unsigned int initialPos,
366 V& unifiedMeanVec)
const
368 unsigned int tmpUnif = this->unifiedSequenceSize();
369 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
370 *m_env.subDisplayFile() <<
"Entering SequenceOfVectors<V,M>::unifiedMeanExtra()"
371 <<
": initialPos = " << initialPos
372 <<
", numPos = " << numPos
373 <<
", sub sequence size = " << this->subSequenceSize()
374 <<
", unified sequence size = " << tmpUnif
378 bool bRC = ((initialPos < this->subSequenceSize() ) &&
380 ((initialPos+numPos) <= this->subSequenceSize() ) &&
381 (this->vectorSizeLocal() == unifiedMeanVec.sizeLocal()));
382 if ((bRC ==
false) && (m_env.subDisplayFile())) {
383 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedMeanExtra()"
384 <<
", initialPos = " << initialPos
385 <<
", this->subSequenceSize() = " << this->subSequenceSize()
386 <<
", numPos = " << numPos
387 <<
", this->vectorSizeLocal() = " << this->vectorSizeLocal()
388 <<
", unifiedMeanVec.sizeLocal() = " << unifiedMeanVec.sizeLocal()
391 queso_require_msg(bRC,
"invalid input data");
395 unsigned int numParams = this->vectorSizeLocal();
396 for (
unsigned int i = 0; i < numParams; ++i) {
397 this->extractScalarSeq(initialPos,
402 unifiedMeanVec[i] = data.
unifiedMeanExtra(m_vectorSpace.numOfProcsForStorage() == 1,
407 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
408 *m_env.subDisplayFile() <<
"Leaving SequenceOfVectors<V,M>::unifiedMeanExtra()"
409 <<
": initialPos = " << initialPos
410 <<
", numPos = " << numPos
411 <<
", sub sequence size = " << this->subSequenceSize()
412 <<
", unified sequence size = " << tmpUnif
413 <<
", unifiedMeanVec = " << unifiedMeanVec
420 template <
class V,
class M>
423 unsigned int initialPos,
427 if (this->subSequenceSize() == 0)
return;
429 bool bRC = ((initialPos < this->subSequenceSize()) &&
431 ((initialPos+numPos) <= this->subSequenceSize()));
433 std::cerr <<
"In SequenceOfVectors<V,M>::subMedianExtra()"
434 <<
": ERROR at fullRank " << m_env.fullRank()
435 <<
", initialPos = " << initialPos
436 <<
", numPos = " << numPos
437 <<
", this->subSequenceSize() = " << this->subSequenceSize()
439 if (m_env.subDisplayFile()) {
440 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::subMedianExtra()"
441 <<
": ERROR at fullRank " << m_env.fullRank()
442 <<
", initialPos = " << initialPos
443 <<
", numPos = " << numPos
444 <<
", this->subSequenceSize() = " << this->subSequenceSize()
448 queso_require_msg(bRC,
"invalid input data");
452 unsigned int numParams = this->vectorSizeLocal();
453 for (
unsigned int i = 0; i < numParams; ++i) {
454 this->extractScalarSeq(initialPos,
463 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
464 *m_env.subDisplayFile() <<
"Leaving SequenceOfVectors<V,M>::subMedianExtra()"
465 <<
": initialPos = " << initialPos
466 <<
", numPos = " << numPos
467 <<
", sub sequence size = " << this->subSequenceSize()
468 <<
", medianVec = " << medianVec
475 template <
class V,
class M>
478 unsigned int initialPos,
480 V& unifiedMedianVec)
const
482 unsigned int tmpUnif = this->unifiedSequenceSize();
483 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
484 *m_env.subDisplayFile() <<
"Entering SequenceOfVectors<V,M>::unifiedMedianExtra()"
485 <<
": initialPos = " << initialPos
486 <<
", numPos = " << numPos
487 <<
", sub sequence size = " << this->subSequenceSize()
488 <<
", unified sequence size = " << tmpUnif
492 bool bRC = ((initialPos < this->subSequenceSize() ) &&
494 ((initialPos+numPos) <= this->subSequenceSize() ) &&
495 (this->vectorSizeLocal() == unifiedMedianVec.sizeLocal()));
496 if ((bRC ==
false) && (m_env.subDisplayFile())) {
497 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedMedianExtra()"
498 <<
", initialPos = " << initialPos
499 <<
", this->subSequenceSize() = " << this->subSequenceSize()
500 <<
", numPos = " << numPos
501 <<
", this->vectorSizeLocal() = " << this->vectorSizeLocal()
502 <<
", unifiedMedianVec.sizeLocal() = " << unifiedMedianVec.sizeLocal()
505 queso_require_msg(bRC,
"invalid input data");
509 unsigned int numParams = this->vectorSizeLocal();
510 for (
unsigned int i = 0; i < numParams; ++i) {
511 this->extractScalarSeq(initialPos,
516 unifiedMedianVec[i] = data.
unifiedMedianExtra(m_vectorSpace.numOfProcsForStorage() == 1,
521 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
522 *m_env.subDisplayFile() <<
"Leaving SequenceOfVectors<V,M>::unifiedMedianExtra()"
523 <<
": initialPos = " << initialPos
524 <<
", numPos = " << numPos
525 <<
", sub sequence size = " << this->subSequenceSize()
526 <<
", unified sequence size = " << tmpUnif
527 <<
", unifiedMedianVec = " << unifiedMedianVec
534 template <
class V,
class M>
537 unsigned int initialPos,
542 bool bRC = ((initialPos < this->subSequenceSize()) &&
544 ((initialPos+numPos) <= this->subSequenceSize()) &&
545 (this->vectorSizeLocal() == meanVec.sizeLocal() ) &&
546 (this->vectorSizeLocal() == samVec.sizeLocal() ));
547 queso_require_msg(bRC,
"invalid input data");
551 unsigned int numParams = this->vectorSizeLocal();
552 for (
unsigned int i = 0; i < numParams; ++i) {
553 this->extractScalarSeq(initialPos,
566 template <
class V,
class M>
569 unsigned int initialPos,
571 const V& unifiedMeanVec,
572 V& unifiedSamVec)
const
574 bool bRC = ((initialPos < this->subSequenceSize() ) &&
576 ((initialPos+numPos) <= this->subSequenceSize() ) &&
577 (this->vectorSizeLocal() == unifiedMeanVec.sizeLocal()) &&
578 (this->vectorSizeLocal() == unifiedSamVec.sizeLocal() ));
579 queso_require_msg(bRC,
"invalid input data");
583 unsigned int numParams = this->vectorSizeLocal();
584 for (
unsigned int i = 0; i < numParams; ++i) {
585 this->extractScalarSeq(initialPos,
599 template <
class V,
class M>
602 unsigned int initialPos,
607 bool bRC = ((initialPos < this->subSequenceSize()) &&
609 ((initialPos+numPos) <= this->subSequenceSize()) &&
610 (this->vectorSizeLocal() == meanVec.sizeLocal() ) &&
611 (this->vectorSizeLocal() == stdvec.sizeLocal() ));
612 queso_require_msg(bRC,
"invalid input data");
616 unsigned int numParams = this->vectorSizeLocal();
617 for (
unsigned int i = 0; i < numParams; ++i) {
618 this->extractScalarSeq(initialPos,
631 template <
class V,
class M>
634 unsigned int initialPos,
636 const V& unifiedMeanVec,
637 V& unifiedStdVec)
const
639 bool bRC = ((initialPos < this->subSequenceSize() ) &&
641 ((initialPos+numPos) <= this->subSequenceSize() ) &&
642 (this->vectorSizeLocal() == unifiedMeanVec.sizeLocal()) &&
643 (this->vectorSizeLocal() == unifiedStdVec.sizeLocal() ));
644 queso_require_msg(bRC,
"invalid input data");
648 unsigned int numParams = this->vectorSizeLocal();
649 for (
unsigned int i = 0; i < numParams; ++i) {
650 this->extractScalarSeq(initialPos,
655 unifiedStdVec[i] = data.
unifiedSampleStd(m_vectorSpace.numOfProcsForStorage() == 1,
664 template <
class V,
class M>
667 unsigned int initialPos,
672 bool bRC = ((initialPos < this->subSequenceSize()) &&
674 ((initialPos+numPos) <= this->subSequenceSize()) &&
675 (this->vectorSizeLocal() == meanVec.sizeLocal() ) &&
676 (this->vectorSizeLocal() == popVec.sizeLocal() ));
677 queso_require_msg(bRC,
"invalid input data");
681 unsigned int numParams = this->vectorSizeLocal();
682 for (
unsigned int i = 0; i < numParams; ++i) {
683 this->extractScalarSeq(initialPos,
696 template <
class V,
class M>
699 unsigned int initialPos,
701 const V& unifiedMeanVec,
702 V& unifiedPopVec)
const
704 bool bRC = ((initialPos < this->subSequenceSize() ) &&
706 ((initialPos+numPos) <= this->subSequenceSize() ) &&
707 (this->vectorSizeLocal() == unifiedMeanVec.sizeLocal()) &&
708 (this->vectorSizeLocal() == unifiedPopVec.sizeLocal() ));
709 queso_require_msg(bRC,
"invalid input data");
713 unsigned int numParams = this->vectorSizeLocal();
714 for (
unsigned int i = 0; i < numParams; ++i) {
715 this->extractScalarSeq(initialPos,
729 template <
class V,
class M>
732 unsigned int initialPos,
738 bool bRC = ((initialPos < this->subSequenceSize()) &&
740 ((initialPos+numPos) <= this->subSequenceSize()) &&
741 (this->vectorSizeLocal() == meanVec.sizeLocal() ) &&
743 (this->vectorSizeLocal() == covVec.sizeLocal() ));
744 queso_require_msg(bRC,
"invalid input data");
748 unsigned int numParams = this->vectorSizeLocal();
749 for (
unsigned int i = 0; i < numParams; ++i) {
750 this->extractScalarSeq(initialPos,
764 template <
class V,
class M>
767 unsigned int initialPos,
772 bool bRC = ((initialPos < this->subSequenceSize()) &&
774 ((initialPos+numPos) <= this->subSequenceSize()) &&
776 (this->vectorSizeLocal() == corrVec.sizeLocal() ));
777 queso_require_msg(bRC,
"invalid input data");
781 unsigned int numParams = this->vectorSizeLocal();
782 for (
unsigned int i = 0; i < numParams; ++i) {
783 this->extractScalarSeq(initialPos,
796 template <
class V,
class M>
799 unsigned int initialPos,
801 const std::vector<unsigned int>& lags,
802 std::vector<V*>& corrVecs)
const
804 bool bRC = ((initialPos < this->subSequenceSize()) &&
806 ((initialPos+numPos) <= this->subSequenceSize()) &&
807 (0 < lags.size() ) &&
808 (lags[lags.size()-1] < numPos ));
809 queso_require_msg(bRC,
"invalid input data");
811 for (
unsigned int j = lags.size(); j < corrVecs.size(); ++j) {
812 if (corrVecs[j] != NULL) {
817 corrVecs.resize(lags.size(),NULL);
818 for (
unsigned int j = 0; j < corrVecs.size(); ++j) {
819 if (corrVecs[j] == NULL) corrVecs[j] =
new V(m_vectorSpace.zeroVector());
823 unsigned int maxLag = lags[lags.size()-1];
824 std::vector<double> autoCorrs(maxLag+1,0.);
826 unsigned int numParams = this->vectorSizeLocal();
827 for (
unsigned int i = 0; i < numParams; ++i) {
828 this->extractScalarSeq(initialPos,
847 for (
unsigned int j = 0; j < lags.size(); ++j) {
848 (*(corrVecs[j]))[i] = autoCorrs[lags[j]];
855 template <
class V,
class M>
858 unsigned int initialPos,
861 V& autoCorrsSumVec)
const
863 bool bRC = ((initialPos < this->subSequenceSize()) &&
865 ((initialPos+numPos) <= this->subSequenceSize()) &&
867 (numSum <= numPos ) &&
868 (autoCorrsSumVec.sizeLocal() == this->vectorSizeLocal()));
869 queso_require_msg(bRC,
"invalid input data");
873 unsigned int numParams = this->vectorSizeLocal();
874 for (
unsigned int i = 0; i < numParams; ++i) {
875 this->extractScalarSeq(initialPos,
890 template <
class V,
class M>
893 unsigned int initialPos,
898 bool bRC = ((0 < numPos ) &&
899 ((initialPos+numPos) <= this->subSequenceSize()) &&
900 (this->vectorSizeLocal() == minVec.sizeLocal() ) &&
901 (this->vectorSizeLocal() == maxVec.sizeLocal() ));
902 queso_require_msg(bRC,
"invalid input data");
905 unsigned int numParams = this->vectorSizeLocal();
908 for (
unsigned int i = 0; i < numParams; ++i) {
909 this->extractScalarSeq(initialPos,
920 template <
class V,
class M>
923 unsigned int initialPos,
926 V& unifiedMaxVec)
const
928 bool bRC = ((0 < numPos ) &&
929 ((initialPos+numPos) <= this->subSequenceSize() ) &&
930 (this->vectorSizeLocal() == unifiedMinVec.sizeLocal()) &&
931 (this->vectorSizeLocal() == unifiedMaxVec.sizeLocal()));
932 queso_require_msg(bRC,
"invalid input data");
935 unsigned int numParams = this->vectorSizeLocal();
938 for (
unsigned int i = 0; i < numParams; ++i) {
939 this->extractScalarSeq(initialPos,
954 template <
class V,
class M>
957 unsigned int initialPos,
960 std::vector<V*>& centersForAllBins,
961 std::vector<V*>& quanttsForAllBins)
const
963 bool bRC = ((initialPos < this->subSequenceSize() ) &&
964 (this->vectorSizeLocal() == minVec.sizeLocal() ) &&
965 (this->vectorSizeLocal() == maxVec.sizeLocal() ) &&
966 (0 < centersForAllBins.size()) &&
967 (centersForAllBins.size() == quanttsForAllBins.size()));
968 queso_require_msg(bRC,
"invalid input data");
970 for (
unsigned int j = 0; j < quanttsForAllBins.size(); ++j) {
971 centersForAllBins[j] =
new V(m_vectorSpace.zeroVector());
972 quanttsForAllBins [j] =
new V(m_vectorSpace.zeroVector());
975 unsigned int dataSize = this->subSequenceSize() - initialPos;
976 unsigned int numParams = this->vectorSizeLocal();
977 for (
unsigned int i = 0; i < numParams; ++i) {
979 for (
unsigned int j = 0; j < dataSize; ++j) {
980 data[j] = (*(m_seq[initialPos+j]))[i];
983 std::vector<double > centers(centersForAllBins.size(),0.);
984 std::vector<unsigned int> quantts(quanttsForAllBins.size(), 0 );
991 for (
unsigned int j = 0; j < quantts.size(); ++j) {
992 (*(centersForAllBins[j]))[i] = centers[j];
993 (*(quanttsForAllBins[j]))[i] = (double) quantts[j];
1000 template <
class V,
class M>
1003 unsigned int initialPos,
1004 const V& unifiedMinVec,
1005 const V& unifiedMaxVec,
1006 std::vector<V*>& unifiedCentersForAllBins,
1007 std::vector<V*>& unifiedQuanttsForAllBins)
const
1009 bool bRC = ((initialPos < this->subSequenceSize() ) &&
1010 (this->vectorSizeLocal() == unifiedMinVec.sizeLocal() ) &&
1011 (this->vectorSizeLocal() == unifiedMaxVec.sizeLocal() ) &&
1012 (0 < unifiedCentersForAllBins.size()) &&
1013 (unifiedCentersForAllBins.size() == unifiedQuanttsForAllBins.size()));
1014 queso_require_msg(bRC,
"invalid input data");
1016 for (
unsigned int j = 0; j < unifiedQuanttsForAllBins.size(); ++j) {
1017 unifiedCentersForAllBins[j] =
new V(m_vectorSpace.zeroVector());
1018 unifiedQuanttsForAllBins [j] =
new V(m_vectorSpace.zeroVector());
1021 unsigned int dataSize = this->subSequenceSize() - initialPos;
1022 unsigned int numParams = this->vectorSizeLocal();
1023 for (
unsigned int i = 0; i < numParams; ++i) {
1025 for (
unsigned int j = 0; j < dataSize; ++j) {
1026 data[j] = (*(m_seq[initialPos+j]))[i];
1029 std::vector<double > unifiedCenters(unifiedCentersForAllBins.size(),0.);
1030 std::vector<unsigned int> unifiedQuantts(unifiedQuanttsForAllBins.size(), 0 );
1038 for (
unsigned int j = 0; j < unifiedQuantts.size(); ++j) {
1039 (*(unifiedCentersForAllBins[j]))[i] = unifiedCenters[j];
1040 (*(unifiedQuanttsForAllBins[j]))[i] = (double) unifiedQuantts[j];
1047 template <
class V,
class M>
1050 unsigned int initialPos,
1053 bool bRC = ((initialPos < this->subSequenceSize()) &&
1054 (this->vectorSizeLocal() == iqrVec.sizeLocal() ));
1055 queso_require_msg(bRC,
"invalid input data");
1057 unsigned int numPos = this->subSequenceSize() - initialPos;
1060 unsigned int numParams = this->vectorSizeLocal();
1061 for (
unsigned int i = 0; i < numParams; ++i) {
1062 this->extractScalarSeq(initialPos,
1073 template <
class V,
class M>
1076 unsigned int initialPos,
1077 V& unifiedIqrVec)
const
1079 bool bRC = ((initialPos < this->subSequenceSize() ) &&
1080 (this->vectorSizeLocal() == unifiedIqrVec.sizeLocal()));
1081 queso_require_msg(bRC,
"invalid input data");
1083 unsigned int numPos = this->subSequenceSize() - initialPos;
1086 unsigned int numParams = this->vectorSizeLocal();
1087 for (
unsigned int i = 0; i < numParams; ++i) {
1088 this->extractScalarSeq(initialPos,
1100 template <
class V,
class M>
1103 unsigned int initialPos,
1105 unsigned int kdeDimension,
1108 bool bRC = ((initialPos < this->subSequenceSize()) &&
1109 (this->vectorSizeLocal() == iqrVec.sizeLocal() ) &&
1110 (this->vectorSizeLocal() == scaleVec.sizeLocal() ));
1111 queso_require_msg(bRC,
"invalid input data");
1113 unsigned int numPos = this->subSequenceSize() - initialPos;
1116 unsigned int numParams = this->vectorSizeLocal();
1117 for (
unsigned int i = 0; i < numParams; ++i) {
1118 this->extractScalarSeq(initialPos,
1131 template <
class V,
class M>
1134 unsigned int initialPos,
1135 const V& unifiedIqrVec,
1136 unsigned int kdeDimension,
1137 V& unifiedScaleVec)
const
1139 bool bRC = ((initialPos < this->subSequenceSize() ) &&
1140 (this->vectorSizeLocal() == unifiedIqrVec.sizeLocal() ) &&
1141 (this->vectorSizeLocal() == unifiedScaleVec.sizeLocal()));
1142 queso_require_msg(bRC,
"invalid input data");
1144 unsigned int numPos = this->subSequenceSize() - initialPos;
1147 unsigned int numParams = this->vectorSizeLocal();
1148 for (
unsigned int i = 0; i < numParams; ++i) {
1149 this->extractScalarSeq(initialPos,
1154 unifiedScaleVec[i] = data.
unifiedScaleForKde(m_vectorSpace.numOfProcsForStorage() == 1,
1163 template <
class V,
class M>
1166 unsigned int initialPos,
1168 const std::vector<V*>& evalParamVecs,
1169 std::vector<V*>& densityVecs)
const
1171 bool bRC = ((initialPos < this->subSequenceSize()) &&
1172 (this->vectorSizeLocal() == scaleVec.sizeLocal() ) &&
1173 (0 < evalParamVecs.size() ) &&
1174 (evalParamVecs.size() == densityVecs.size() ));
1175 queso_require_msg(bRC,
"invalid input data");
1177 unsigned int numPos = this->subSequenceSize() - initialPos;
1180 unsigned int numEvals = evalParamVecs.size();
1181 for (
unsigned int j = 0; j < numEvals; ++j) {
1182 densityVecs[j] =
new V(m_vectorSpace.zeroVector());
1184 std::vector<double> evalParams(numEvals,0.);
1185 std::vector<double> densities (numEvals,0.);
1187 unsigned int numParams = this->vectorSizeLocal();
1188 for (
unsigned int i = 0; i < numParams; ++i) {
1189 this->extractScalarSeq(initialPos,
1195 for (
unsigned int j = 0; j < numEvals; ++j) {
1196 evalParams[j] = (*evalParamVecs[j])[i];
1204 for (
unsigned int j = 0; j < numEvals; ++j) {
1205 (*densityVecs[j])[i] = densities[j];
1212 template <
class V,
class M>
1215 unsigned int initialPos,
1216 const V& unifiedScaleVec,
1217 const std::vector<V*>& unifiedEvalParamVecs,
1218 std::vector<V*>& unifiedDensityVecs)
const
1220 bool bRC = ((initialPos < this->subSequenceSize() ) &&
1221 (this->vectorSizeLocal() == unifiedScaleVec.sizeLocal()) &&
1222 (0 < unifiedEvalParamVecs.size()) &&
1223 (unifiedEvalParamVecs.size() == unifiedDensityVecs.size() ));
1224 queso_require_msg(bRC,
"invalid input data");
1226 unsigned int numPos = this->subSequenceSize() - initialPos;
1229 unsigned int numEvals = unifiedEvalParamVecs.size();
1230 for (
unsigned int j = 0; j < numEvals; ++j) {
1231 unifiedDensityVecs[j] =
new V(m_vectorSpace.zeroVector());
1233 std::vector<double> unifiedEvalParams(numEvals,0.);
1234 std::vector<double> unifiedDensities (numEvals,0.);
1236 unsigned int numParams = this->vectorSizeLocal();
1237 for (
unsigned int i = 0; i < numParams; ++i) {
1238 this->extractScalarSeq(initialPos,
1244 for (
unsigned int j = 0; j < numEvals; ++j) {
1245 unifiedEvalParams[j] = (*unifiedEvalParamVecs[j])[i];
1254 for (
unsigned int j = 0; j < numEvals; ++j) {
1255 (*unifiedDensityVecs[j])[i] = unifiedDensities[j];
1262 template <
class V,
class M>
1265 unsigned int initialPos,
1266 unsigned int numPos,
1267 const std::string& fileName,
1268 const std::string& fileType,
1269 const std::set<unsigned int>& allowedSubEnvIds)
const
1271 queso_require_greater_equal_msg(m_env.subRank(), 0,
"unexpected subRank");
1274 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 99)) {
1275 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::subWriteContents()"
1276 <<
": about to try to open file '" << fileName <<
"." << fileType
1278 <<
", initialPos = " << initialPos
1279 <<
", numPos = " << numPos
1282 if (m_env.openOutputFile(fileName,
1288 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 99)) {
1289 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::subWriteContents()"
1290 <<
": successfully opened file '" << fileName <<
"." << fileType
1294 this->subWriteContents(initialPos,
1298 m_env.closeFile(filePtrSet,fileType);
1300 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 99)) {
1301 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::subWriteContents()"
1302 <<
": before Barrier()"
1305 m_env.subComm().Barrier();
1310 template <
class V,
class M>
1313 unsigned int initialPos,
1314 unsigned int numPos,
1316 const std::string& fileType)
const
1318 if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT ||
1319 fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT) {
1320 queso_require_msg(filePtrSet.
ofsVar,
"filePtrSet.ofsVar should not be NULL");
1321 this->subWriteContents(initialPos,
1326 #ifdef QUESO_HAS_HDF5
1327 else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1330 queso_require_greater_equal_msg(
1333 "filePtrSet.h5Var should not be non-negative");
1336 queso_require_less_equal_msg(
1337 (initialPos+numPos),
1338 this->subSequenceSize(),
1339 "invalid routine input parameters");
1341 unsigned int numParams = m_vectorSpace.dimLocal();
1342 unsigned int chainSize = this->subSequenceSize();
1343 hsize_t dims[2] = { chainSize, numParams };
1346 hid_t dataspace_id = H5Screate_simple(2, dims, dims);
1349 queso_require_greater_equal_msg(
1352 "error creating dataspace with id: " << dataspace_id);
1355 hid_t dataset_id = H5Dcreate(filePtrSet.
h5Var,
1364 queso_require_greater_equal_msg(
1367 "error creating dataset with id: " << dataset_id);
1373 double * data = (
double *)malloc(numParams * chainSize *
sizeof(
double));
1375 for (
unsigned int i = 0; i < chainSize; i++) {
1376 V tmpVec(*(m_seq[i]));
1377 for (
unsigned int j = 0; j < numParams; j++) {
1378 data[numParams*i+j] = tmpVec[j];
1383 herr_t status = H5Dwrite(
1392 queso_require_greater_equal_msg(
1395 "error writing dataset to file with id: " << filePtrSet.
h5Var);
1399 H5Dclose(dataset_id);
1400 H5Sclose(dataspace_id);
1407 queso_error_msg(
"invalid file type");
1413 template <
class V,
class M>
1416 unsigned int initialPos,
1417 unsigned int numPos,
1419 const std::string& fileType)
const
1421 queso_require_less_equal_msg((initialPos+numPos), this->subSequenceSize(),
"invalid routine input parameters");
1423 if (initialPos == 0) {
1424 if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
1426 this->writeSubMatlabHeader(ofs,
1427 this->subSequenceSize(),
1428 this->vectorSizeLocal());
1430 else if (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT) {
1431 this->writeTxtHeader(ofs,
1432 this->subSequenceSize(),
1433 this->vectorSizeLocal());
1437 for (
unsigned int j = initialPos; j < initialPos+numPos; ++j) {
1438 bool savedVectorPrintScientific = m_seq[j]->getPrintScientific();
1439 bool savedVectorPrintState = m_seq[j]->getPrintHorizontally();
1440 m_seq[j]->setPrintScientific (
true);
1441 m_seq[j]->setPrintHorizontally(
true);
1446 m_seq[j]->setPrintHorizontally(savedVectorPrintState);
1447 m_seq[j]->setPrintScientific (savedVectorPrintScientific);
1451 if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) &&
1452 ((initialPos + numPos) == this->subSequenceSize())) {
1457 template <
class V,
class M>
1460 double sequenceSize,
double vectorSizeLocal)
const
1462 ofs << m_name <<
"_sub" << m_env.subIdString() <<
" = zeros(" << sequenceSize
1463 <<
"," << vectorSizeLocal
1466 ofs << m_name <<
"_sub" << m_env.subIdString() <<
" = [";
1469 template <
class V,
class M>
1472 double sequenceSize,
double vectorSizeLocal)
const
1474 ofs << m_name <<
"_unified" <<
" = zeros(" << sequenceSize
1475 <<
"," << vectorSizeLocal
1478 ofs<< m_name <<
"_unified" <<
" = [";
1481 template <
class V,
class M>
1484 double sequenceSize,
double vectorSizeLocal)
const
1486 ofs << sequenceSize <<
" " << vectorSizeLocal
1491 template <
class V,
class M>
1494 const std::string& fileName,
1495 const std::string& inputFileType)
const
1497 std::string fileType(inputFileType);
1498 #ifdef QUESO_HAS_HDF5
1501 if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1502 if (m_env.subDisplayFile()) {
1503 *m_env.subDisplayFile() <<
"WARNING in SequenceOfVectors<V,M>::unifiedWriteContents()"
1504 <<
": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1505 <<
"' has been requested, but this QUESO library has not been built with 'hdf5'"
1506 <<
". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1510 if (m_env.subRank() == 0) {
1511 std::cerr <<
"WARNING in SequenceOfVectors<V,M>::unifiedWriteContents()"
1512 <<
": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1513 <<
"' has been requested, but this QUESO library has not been built with 'hdf5'"
1514 <<
". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1518 fileType = UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT;
1525 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 10)) {
1526 *m_env.subDisplayFile() <<
"Entering SequenceOfVectors<V,M>::unifiedWriteContents()"
1527 <<
": worldRank " << m_env.worldRank()
1528 <<
", fullRank " << m_env.fullRank()
1529 <<
", subEnvironment " << m_env.subId()
1530 <<
", subRank " << m_env.subRank()
1531 <<
", inter0Rank " << m_env.inter0Rank()
1533 <<
", fileName = " << fileName
1537 if (m_env.inter0Rank() >= 0) {
1538 for (
unsigned int r = 0; r < (
unsigned int) m_env.inter0Comm().NumProc(); ++r) {
1539 if (m_env.inter0Rank() == (int) r) {
1541 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 10)) {
1542 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedWriteContents()"
1543 <<
": worldRank " << m_env.worldRank()
1544 <<
", fullRank " << m_env.fullRank()
1545 <<
", subEnvironment " << m_env.subId()
1546 <<
", subRank " << m_env.subRank()
1547 <<
", inter0Rank " << m_env.inter0Rank()
1549 <<
", fileName = " << fileName
1550 <<
", about to open file for r = " << r
1555 bool writeOver =
false;
1558 if (m_env.openUnifiedOutputFile(fileName,
1561 unifiedFilePtrSet)) {
1562 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 10)) {
1563 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedWriteContents()"
1564 <<
": worldRank " << m_env.worldRank()
1565 <<
", fullRank " << m_env.fullRank()
1566 <<
", subEnvironment " << m_env.subId()
1567 <<
", subRank " << m_env.subRank()
1568 <<
", inter0Rank " << m_env.inter0Rank()
1570 <<
", fileName = " << fileName
1571 <<
", just opened file for r = " << r
1575 unsigned int chainSize = this->subSequenceSize();
1576 if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
1577 (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
1579 if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
1581 writeUnifiedMatlabHeader(*unifiedFilePtrSet.
ofsVar,
1582 this->subSequenceSize()*m_env.inter0Comm().NumProc(),
1583 this->vectorSizeLocal());
1586 writeTxtHeader(*unifiedFilePtrSet.
ofsVar,
1587 this->subSequenceSize()*m_env.inter0Comm().NumProc(),
1588 this->vectorSizeLocal());
1592 for (
unsigned int j = 0; j < chainSize; ++j) {
1605 bool savedVectorPrintScientific = m_seq[j]->getPrintScientific();
1606 bool savedVectorPrintState = m_seq[j]->getPrintHorizontally();
1607 m_seq[j]->setPrintScientific (
true);
1608 m_seq[j]->setPrintHorizontally(
true);
1610 *unifiedFilePtrSet.
ofsVar << *(m_seq[j])
1613 m_seq[j]->setPrintHorizontally(savedVectorPrintState);
1614 m_seq[j]->setPrintScientific (savedVectorPrintScientific);
1617 #ifdef QUESO_HAS_HDF5
1618 else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1619 unsigned int numParams = m_vectorSpace.dimLocal();
1621 hid_t datatype = H5Tcopy(H5T_NATIVE_DOUBLE);
1624 dimsf[0] = chainSize;
1625 dimsf[1] = numParams;
1626 hid_t dataspace = H5Screate_simple(2, dimsf, NULL);
1628 hid_t dataset = H5Dcreate2(unifiedFilePtrSet.
h5Var,
1637 struct timeval timevalBegin;
1639 iRC = gettimeofday(&timevalBegin,NULL);
1643 data = (
double *)malloc(numParams * chainSize *
sizeof(
double));
1645 for (
unsigned int i = 0; i < chainSize; ++i) {
1646 V tmpVec(*(m_seq[i]));
1647 for (
unsigned int j = 0; j < numParams; ++j) {
1648 data[numParams*i+j] = tmpVec[j];
1653 status = H5Dwrite(dataset,
1663 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
1664 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedWriteContents()"
1665 <<
": worldRank " << m_env.worldRank()
1666 <<
", fullRank " << m_env.fullRank()
1667 <<
", subEnvironment " << m_env.subId()
1668 <<
", subRank " << m_env.subRank()
1669 <<
", inter0Rank " << m_env.inter0Rank()
1670 <<
", fileName = " << fileName
1671 <<
", numParams = " << numParams
1672 <<
", chainSize = " << chainSize
1673 <<
", writeTime = " << writeTime <<
" seconds"
1679 H5Sclose(dataspace);
1686 queso_error_msg(
"hdf file type not supported for multiple sub-environments yet");
1691 queso_error_msg(
"invalid file type");
1694 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 10)) {
1695 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedWriteContents()"
1696 <<
": worldRank " << m_env.worldRank()
1697 <<
", fullRank " << m_env.fullRank()
1698 <<
", subEnvironment " << m_env.subId()
1699 <<
", subRank " << m_env.subRank()
1700 <<
", inter0Rank " << m_env.inter0Rank()
1702 <<
", fileName = " << fileName
1703 <<
", about to close file for r = " << r
1707 m_env.closeFile(unifiedFilePtrSet,fileType);
1709 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 10)) {
1710 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedWriteContents()"
1711 <<
": worldRank " << m_env.worldRank()
1712 <<
", fullRank " << m_env.fullRank()
1713 <<
", subEnvironment " << m_env.subId()
1714 <<
", subRank " << m_env.subRank()
1715 <<
", inter0Rank " << m_env.inter0Rank()
1717 <<
", fileName = " << fileName
1718 <<
", just closed file for r = " << r
1723 m_env.inter0Comm().Barrier();
1726 if (m_env.inter0Rank() == 0) {
1727 if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
1728 (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
1730 if (m_env.openUnifiedOutputFile(fileName,
1733 unifiedFilePtrSet)) {
1735 if (fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) {
1736 *unifiedFilePtrSet.
ofsVar <<
"];\n";
1739 m_env.closeFile(unifiedFilePtrSet,fileType);
1742 else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1746 queso_error_msg(
"invalid file type");
1751 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 10)) {
1752 *m_env.subDisplayFile() <<
"Leaving SequenceOfVectors<V,M>::unifiedWriteContents()"
1753 <<
", fileName = " << fileName
1761 template <
class V,
class M>
1764 const std::string& fileName,
1765 const std::string& inputFileType,
1766 const unsigned int subReadSize)
1768 std::string fileType(inputFileType);
1769 #ifdef QUESO_HAS_HDF5
1772 if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1773 if (m_env.subDisplayFile()) {
1774 *m_env.subDisplayFile() <<
"WARNING in SequenceOfVectors<V,M>::unifiedReadContents()"
1775 <<
": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1776 <<
"' has been requested, but this QUESO library has not been built with 'hdf5'"
1777 <<
". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1781 if (m_env.subRank() == 0) {
1782 std::cerr <<
"WARNING in SequenceOfVectors<V,M>::unifiedReadContents()"
1783 <<
": file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1784 <<
"' has been requested, but this QUESO library has not been built with 'hdf5'"
1785 <<
". Code will therefore process the file format '" << UQ_FILE_EXTENSION_FOR_HDF_FORMAT
1789 fileType = UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT;
1794 if (m_env.subDisplayFile()) {
1795 *m_env.subDisplayFile() <<
"Entering SequenceOfVectors<V,M>::unifiedReadContents()"
1796 <<
": worldRank " << m_env.worldRank()
1797 <<
", fullRank " << m_env.fullRank()
1798 <<
", subEnvironment " << m_env.subId()
1799 <<
", subRank " << m_env.subRank()
1800 <<
", inter0Rank " << m_env.inter0Rank()
1802 <<
", fileName = " << fileName
1803 <<
", subReadSize = " << subReadSize
1808 this->resizeSequence(subReadSize);
1810 if (m_env.inter0Rank() >= 0) {
1811 double unifiedReadSize = subReadSize*m_env.inter0Comm().NumProc();
1814 unsigned int idOfMyFirstLine = 1 + m_env.inter0Rank()*subReadSize;
1815 unsigned int idOfMyLastLine = (1 + m_env.inter0Rank())*subReadSize;
1816 unsigned int numParams = this->vectorSizeLocal();
1818 for (
unsigned int r = 0; r < (
unsigned int) m_env.inter0Comm().NumProc(); ++r) {
1819 if (m_env.inter0Rank() == (int) r) {
1822 if (m_env.openUnifiedInputFile(fileName,
1824 unifiedFilePtrSet)) {
1825 if ((fileType == UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT) ||
1826 (fileType == UQ_FILE_EXTENSION_FOR_TXT_FORMAT)) {
1830 std::string tmpString;
1833 *unifiedFilePtrSet.
ifsVar >> tmpString;
1837 *unifiedFilePtrSet.
ifsVar >> tmpString;
1842 *unifiedFilePtrSet.
ifsVar >> tmpString;
1844 unsigned int posInTmpString = 6;
1848 std::string nPositionsString((
size_t) (tmpString.size()-posInTmpString+1),
' ');
1849 unsigned int posInPositionsString = 0;
1851 queso_require_less_msg(posInTmpString, tmpString.size(),
"symbol ',' not found in first line of file");
1852 nPositionsString[posInPositionsString++] = tmpString[posInTmpString++];
1853 }
while (tmpString[posInTmpString] !=
',');
1854 nPositionsString[posInPositionsString] =
'\0';
1859 std::string nParamsString((
size_t) (tmpString.size()-posInTmpString+1),
' ');
1860 unsigned int posInParamsString = 0;
1862 queso_require_less_msg(posInTmpString, tmpString.size(),
"symbol ')' not found in first line of file");
1863 nParamsString[posInParamsString++] = tmpString[posInTmpString++];
1864 }
while (tmpString[posInTmpString] !=
')');
1865 nParamsString[posInParamsString] =
'\0';
1868 unsigned int sizeOfChainInFile = (
unsigned int) strtod(nPositionsString.c_str(),NULL);
1869 unsigned int numParamsInFile = (
unsigned int) strtod(nParamsString.c_str(), NULL);
1870 if (m_env.subDisplayFile()) {
1871 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedReadContents()"
1872 <<
": worldRank " << m_env.worldRank()
1873 <<
", fullRank " << m_env.fullRank()
1874 <<
", sizeOfChainInFile = " << sizeOfChainInFile
1875 <<
", numParamsInFile = " << numParamsInFile
1880 queso_require_greater_equal_msg(sizeOfChainInFile, unifiedReadSize,
"size of chain in file is not big enough");
1883 queso_require_equal_to_msg(numParamsInFile, numParams,
"number of parameters of chain in file is different than number of parameters in this chain object");
1887 unsigned int maxCharsPerLine = 64*numParams;
1889 unsigned int lineId = 0;
1890 while (lineId < idOfMyFirstLine) {
1891 unifiedFilePtrSet.
ifsVar->ignore(maxCharsPerLine,
'\n');
1898 std::string tmpString;
1901 *unifiedFilePtrSet.
ifsVar >> tmpString;
1905 *unifiedFilePtrSet.
ifsVar >> tmpString;
1910 std::streampos tmpPos = unifiedFilePtrSet.
ifsVar->tellg();
1911 unifiedFilePtrSet.
ifsVar->seekg(tmpPos+(std::streampos)2);
1914 V tmpVec(m_vectorSpace.zeroVector());
1915 while (lineId <= idOfMyLastLine) {
1916 for (
unsigned int i = 0; i < numParams; ++i) {
1917 *unifiedFilePtrSet.
ifsVar >> tmpVec[i];
1919 this->setPositionValues(lineId - idOfMyFirstLine, tmpVec);
1923 #ifdef QUESO_HAS_HDF5
1924 else if (fileType == UQ_FILE_EXTENSION_FOR_HDF_FORMAT) {
1926 hid_t dataset = H5Dopen2(unifiedFilePtrSet.
h5Var,
1929 hid_t datatype = H5Dget_type(dataset);
1930 H5T_class_t t_class = H5Tget_class(datatype);
1932 hid_t dataspace = H5Dget_space(dataset);
1933 int rank = H5Sget_simple_extent_ndims(dataspace);
1937 status_n = H5Sget_simple_extent_dims(dataspace, dims_in, NULL);
1944 queso_require_greater_equal_msg(dims_in[1], subReadSize,
"dims_in[1] is smaller that requested 'subReadSize'");
1946 struct timeval timevalBegin;
1948 iRC = gettimeofday(&timevalBegin,NULL);
1951 unsigned int chainSizeIn = (
unsigned int) dims_in[1];
1953 std::vector<double*> dataIn((
size_t) numParams,NULL);
1954 dataIn[0] = (
double*) malloc(numParams*chainSizeIn*
sizeof(
double));
1955 for (
unsigned int i = 1; i < numParams; ++i) {
1956 dataIn[i] = dataIn[i-1] + chainSizeIn;
1960 status = H5Dread(dataset,
1968 V tmpVec(m_vectorSpace.zeroVector());
1969 for (
unsigned int j = 0; j < subReadSize; ++j) {
1970 for (
unsigned int i = 0; i < numParams; ++i) {
1971 tmpVec[i] = dataIn[i][j];
1973 this->setPositionValues(j, tmpVec);
1977 if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 2)) {
1978 *m_env.subDisplayFile() <<
"In SequenceOfVectors<V,M>::unifiedReadContents()"
1979 <<
": worldRank " << m_env.worldRank()
1980 <<
", fullRank " << m_env.fullRank()
1981 <<
", subEnvironment " << m_env.subId()
1982 <<
", subRank " << m_env.subRank()
1983 <<
", inter0Rank " << m_env.inter0Rank()
1984 <<
", fileName = " << fileName
1985 <<
", numParams = " << numParams
1986 <<
", chainSizeIn = " << chainSizeIn
1987 <<
", subReadSize = " << subReadSize
1988 <<
", readTime = " << readTime <<
" seconds"
1992 H5Sclose(dataspace);
1996 for (
unsigned int tmpIndex = 0; tmpIndex < dataIn.size(); tmpIndex++) {
1997 free (dataIn[tmpIndex]);
2001 queso_error_msg(
"hdf file type not supported for multiple sub-environments yet");
2006 queso_error_msg(
"invalid file type");
2008 m_env.closeFile(unifiedFilePtrSet,fileType);
2011 m_env.inter0Comm().Barrier();
2015 V tmpVec(m_vectorSpace.zeroVector());
2016 for (
unsigned int i = 1; i < subReadSize; ++i) {
2017 this->setPositionValues(i,tmpVec);
2021 if (m_env.subDisplayFile()) {
2022 *m_env.subDisplayFile() <<
"Leaving SequenceOfVectors<V,M>::unifiedReadContents()"
2023 <<
", fileName = " << fileName
2031 template <
class V,
class M>
2035 queso_error_msg(
"Code is not complete yet");
2040 template <
class V,
class M>
2043 unsigned int initialPos,
2044 unsigned int spacing)
2046 if (m_env.subDisplayFile()) {
2047 *m_env.subDisplayFile() <<
"Entering SequenceOfVectors<V,M>::filter()"
2048 <<
": initialPos = " << initialPos
2049 <<
", spacing = " << spacing
2050 <<
", subSequenceSize = " << this->subSequenceSize()
2055 unsigned int j = initialPos;
2056 unsigned int originalSubSequenceSize = this->subSequenceSize();
2057 while (j < originalSubSequenceSize) {
2061 m_seq[i] =
new V(*(m_seq[j]));
2067 this->resetValues(i,originalSubSequenceSize-i);
2068 this->resizeSequence(i);
2070 if (m_env.subDisplayFile()) {
2071 *m_env.subDisplayFile() <<
"Leaving SequenceOfVectors<V,M>::filter()"
2072 <<
": initialPos = " << initialPos
2073 <<
", spacing = " << spacing
2074 <<
", subSequenceSize = " << this->subSequenceSize()
2081 template <
class V,
class M>
2084 unsigned int initialPos,
2085 unsigned int numPos)
const
2088 queso_require_greater_equal_msg(m_env.numSubEnvironments(), 2,
"At least two sequences required for Brooks-Gelman convergence test.");
2093 double convMeasure = -1.0;
2097 if( m_env.inter0Rank() >= 0 )
2103 V psi_j_dot = m_vectorSpace.zeroVector();
2104 V psi_dot_dot = m_vectorSpace.zeroVector();
2105 V work = m_vectorSpace.zeroVector();
2109 int m = m_env.numSubEnvironments();
2112 this->subMeanExtra ( initialPos, numPos, psi_j_dot );
2113 this->unifiedMeanExtra( initialPos, numPos, psi_dot_dot );
2116 std::cout <<
"psi_j_dot = " << psi_j_dot << std::endl;
2117 std::cout <<
"psi_dot_dot = " << psi_dot_dot << std::endl;
2123 M* W_local = m_vectorSpace.newDiagMatrix( m_vectorSpace.zeroVector() );
2124 M* W = m_vectorSpace.newDiagMatrix( m_vectorSpace.zeroVector() );
2125 V psi_j_t = m_vectorSpace.zeroVector();
2128 for(
unsigned int t = initialPos; t < initialPos+numPos; ++t )
2130 psi_j_t = *(m_seq[t]);
2132 work = psi_j_t - psi_j_dot;
2139 W_local->mpiSum( m_env.inter0Comm(), (*W) );
2141 (*W) = 1.0/(double(m)*(double(n)-1.0)) * (*W);
2144 std::cout <<
"n, m = " << n <<
", " << m << std::endl;
2145 std::cout <<
"W_local = " << *W_local << std::endl;
2146 std::cout <<
"W = " << *W << std::endl;
2156 M* B_over_n_local = m_vectorSpace.newDiagMatrix( m_vectorSpace.zeroVector() );
2157 M* B_over_n = m_vectorSpace.newDiagMatrix( m_vectorSpace.zeroVector() );
2159 work = psi_j_dot - psi_dot_dot;
2162 B_over_n_local->mpiSum( m_env.inter0Comm(), (*B_over_n) );
2165 delete B_over_n_local;
2167 (*B_over_n) = 1.0/(double(m)-1.0) * (*B_over_n);
2170 std::cout <<
"B_over_n = " << *B_over_n << std::endl;
2176 M* A = m_vectorSpace.newDiagMatrix( m_vectorSpace.zeroVector() );
2178 W->invertMultiply( *B_over_n, *A );
2181 std::cout <<
"A = " << *A << std::endl;
2189 V eigenVector = m_vectorSpace.zeroVector();
2191 A->largestEigen( eigenValue, eigenVector );
2197 convMeasure = (double(n)-1.0)/double(n) + (double(m)+1.0)/double(m)*eigenValue;
2208 template <
class V,
class M>
2211 unsigned int initialPos,
2212 unsigned int spacing,
2213 unsigned int numPos,
2214 unsigned int paramId,
2219 for (
unsigned int j = 0; j < numPos; ++j) {
2220 scalarSeq[j] = (*(m_seq[initialPos+j ]))[paramId];
2224 for (
unsigned int j = 0; j < numPos; ++j) {
2225 scalarSeq[j] = (*(m_seq[initialPos+j*spacing]))[paramId];
2232 template <
class V,
class M>
2237 for (
unsigned int i = 0; i < (
unsigned int) m_seq.size(); ++i) {
2244 for (
unsigned int i = 0; i < m_seq.size(); ++i) {
2245 m_seq[i] =
new V(*(src.
m_seq[i]));
2251 template <
class V,
class M>
2254 unsigned int initialPos,
2255 unsigned int spacing,
2256 unsigned int numPos,
2257 unsigned int paramId,
2258 std::vector<double>& rawData)
const
2260 rawData.resize(numPos);
2262 for (
unsigned int j = 0; j < numPos; ++j) {
2263 rawData[j] = (*(m_seq[initialPos+j ]))[paramId];
2267 for (
unsigned int j = 0; j < numPos; ++j) {
2268 rawData[j] = (*(m_seq[initialPos+j*spacing]))[paramId];
2279 #ifdef UQ_SEQ_VEC_USES_OPERATOR
2280 template <
class V,
class M>
2284 queso_require_less_msg(posId, this->subSequenceSize(),
"posId > subSequenceSize()");
2286 return (
const V*) (m_seq[posId]);
2289 template <
class V,
class M>
2293 queso_require_less_msg(posId, this->subSequenceSize(),
"posId > subSequenceSize()");
2295 return m_seq[posId];
2303 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
2304 template <
class V,
class M>
2307 const V& numEvaluationPointsVec,
2311 V minDomainValues(m_vectorSpace.zeroVector());
2312 V maxDomainValues(m_vectorSpace.zeroVector());
2316 unsigned int numParams = this->vectorSizeLocal();
2317 for (
unsigned int i = 0; i < numParams; ++i) {
2318 this->extractScalarSeq(0,
2324 std::vector<double> aMdf(0);
2325 data.subUniformlySampledMdf((
unsigned int) numEvaluationPointsVec[i],
2344 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
2345 template <
class V,
class M>
2348 unsigned int initialPos,
2349 unsigned int numPos,
2353 bool bRC = ((initialPos < this->subSequenceSize()) &&
2355 ((initialPos+numPos) <= this->subSequenceSize()) &&
2356 (this->vectorSizeLocal() == meanVec.sizeLocal() ) &&
2357 (this->vectorSizeLocal() == stdVec.sizeLocal() ));
2358 queso_require_msg(bRC,
"invalid input data");
2362 unsigned int numParams = this->vectorSizeLocal();
2363 for (
unsigned int i = 0; i < numParams; ++i) {
2364 this->extractScalarSeq(initialPos,
2377 template <
class V,
class M>
2380 unsigned int initialPos,
2381 unsigned int numPos,
2382 const V& unifiedMeanVec,
2383 V& unifiedSamVec)
const
2385 bool bRC = ((initialPos < this->subSequenceSize() ) &&
2387 ((initialPos+numPos) <= this->subSequenceSize() ) &&
2388 (this->vectorSizeLocal() == unifiedMeanVec.sizeLocal()) &&
2389 (this->vectorSizeLocal() == unifiedSamVec.sizeLocal() ));
2390 queso_require_msg(bRC,
"invalid input data");
2394 unsigned int numParams = this->vectorSizeLocal();
2395 for (
unsigned int i = 0; i < numParams; ++i) {
2396 this->extractScalarSeq(initialPos,
2401 unifiedSamVec[i] = data.
unifiedMeanCltStd(m_vectorSpace.numOfProcsForStorage() == 1,
2410 template <
class V,
class M>
2413 unsigned int initialPos,
2414 unsigned int batchLength,
2417 bool bRC = ((initialPos < this->subSequenceSize() ) &&
2418 (batchLength < (this->subSequenceSize()-initialPos)) &&
2419 (this->vectorSizeLocal() == bmmVec.sizeLocal() ));
2420 queso_require_msg(bRC,
"invalid input data");
2424 unsigned int numParams = this->vectorSizeLocal();
2425 for (
unsigned int i = 0; i < numParams; ++i) {
2426 this->extractScalarSeq(initialPos,
2428 this->subSequenceSize()-initialPos,
2431 bmmVec[i] = data.
bmm(0,
2438 template <
class V,
class M>
2441 unsigned int initialPos,
2442 unsigned int fftSize,
2443 unsigned int paramId,
2444 std::vector<std::complex<double> >& fftResult)
const
2446 bool bRC = ((initialPos < this->subSequenceSize()) &&
2447 (paramId < this->vectorSizeLocal()) &&
2449 ((initialPos+fftSize) <= this->subSequenceSize()) &&
2450 (fftSize < this->subSequenceSize()));
2451 queso_require_msg(bRC,
"invalid input data");
2453 std::vector<double> rawData(fftSize,0.);
2454 this->extractRawData(initialPos,
2460 m_fftObj->forward(rawData,fftSize,fftResult);
2465 template <
class V,
class M>
2468 unsigned int initialPos,
2469 unsigned int numBlocks,
2470 double hopSizeRatio,
2471 unsigned int paramId,
2472 std::vector<double>& psdResult)
const
2474 bool bRC = ((initialPos < this->subSequenceSize()) &&
2475 (paramId < this->vectorSizeLocal()));
2476 queso_require_msg(bRC,
"invalid input data");
2480 this->extractScalarSeq(initialPos,
2482 this->subSequenceSize()-initialPos,
2493 template <
class V,
class M>
2496 unsigned int initialPos,
2497 unsigned int numBlocks,
2498 double hopSizeRatio,
2501 bool bRC = ((initialPos < this->subSequenceSize()) &&
2502 (this->vectorSizeLocal() == psdVec.sizeLocal()));
2503 queso_require_msg(bRC,
"invalid input data");
2506 std::vector<double> psdResult(0,0.);
2508 unsigned int numParams = this->vectorSizeLocal();
2509 for (
unsigned int i = 0; i < numParams; ++i) {
2510 this->extractScalarSeq(initialPos,
2512 this->subSequenceSize()-initialPos,
2519 psdVec[i] = psdResult[0];
2526 template <
class V,
class M>
2529 unsigned int initialPos,
2534 bool bRC = ((initialPos < this->subSequenceSize()) &&
2535 (this->vectorSizeLocal() == gewVec.sizeLocal() ));
2536 queso_require_msg(bRC,
"invalid input data");
2538 unsigned int numPos = this->subSequenceSize() - initialPos;
2541 unsigned int numParams = this->vectorSizeLocal();
2542 for (
unsigned int i = 0; i < numParams; ++i) {
2543 this->extractScalarSeq(initialPos,
2548 gewVec[i] = data.
geweke(0,
2556 template <
class V,
class M>
2559 unsigned int initialPos,
2560 V& meanStaccVec)
const
2562 bool bRC = ((initialPos < this->subSequenceSize() ) &&
2563 (this->vectorSizeLocal() == meanStaccVec.sizeLocal()));
2564 queso_require_msg(bRC,
"invalid input data");
2566 unsigned int numPos = this->subSequenceSize() - initialPos;
2569 unsigned int numParams = this->vectorSizeLocal();
2570 for (
unsigned int i = 0; i < numParams; ++i) {
2571 this->extractScalarSeq(initialPos,
2582 template <
class V,
class M>
2585 unsigned int initialPos,
2586 unsigned int numPos,
2591 bool bRC = ((0 < numPos ) &&
2592 ((initialPos+numPos) <= this->subSequenceSize()) &&
2593 (this->vectorSizeLocal() == lowerVec.sizeLocal() ) &&
2594 (this->vectorSizeLocal() == upperVec.sizeLocal() ));
2595 queso_require_msg(bRC,
"invalid input data");
2597 unsigned int numParams = this->vectorSizeLocal();
2600 for (
unsigned int i = 0; i < numParams; ++i) {
2601 this->extractScalarSeq(initialPos,
2616 template <
class V,
class M>
2619 unsigned int initialPos,
2620 unsigned int numPos,
2625 bool bRC = ((0 < numPos ) &&
2626 ((initialPos+numPos) <= this->subSequenceSize()) &&
2627 (this->vectorSizeLocal() == lowerVec.sizeLocal() ) &&
2628 (this->vectorSizeLocal() == upperVec.sizeLocal() ));
2629 queso_require_msg(bRC,
"invalid input data");
2631 unsigned int numParams = this->vectorSizeLocal();
2634 for (
unsigned int i = 0; i < numParams; ++i) {
2635 this->extractScalarSeq(initialPos,
2651 template <
class V,
class M>
2654 unsigned int initialPos,
2655 std::vector<V*>& cdfStaccVecs,
2656 std::vector<V*>& cdfStaccVecsUp,
2657 std::vector<V*>& cdfStaccVecsLow,
2658 std::vector<V*>& sortedDataVecs)
const
2660 bool bRC = (initialPos < this->subSequenceSize());
2661 queso_require_msg(bRC,
"invalid input data");
2663 unsigned int numPos = this->subSequenceSize() - initialPos;
2664 unsigned int numEvals = numPos;
2665 for (
unsigned int j = 0; j < numEvals; ++j) {
2666 cdfStaccVecs [j] =
new V(m_vectorSpace.zeroVector());
2667 cdfStaccVecsUp [j] =
new V(m_vectorSpace.zeroVector());
2668 cdfStaccVecsLow[j] =
new V(m_vectorSpace.zeroVector());
2669 sortedDataVecs [j] =
new V(m_vectorSpace.zeroVector());
2671 std::vector<double> cdfStaccs (numEvals,0.);
2672 std::vector<double> cdfStaccsup (numEvals,0.);
2673 std::vector<double> cdfStaccslow(numEvals,0.);
2677 unsigned int numParams = this->vectorSizeLocal();
2678 for (
unsigned int i = 0; i < numParams; ++i) {
2679 this->extractScalarSeq(initialPos,
2685 data.
subSort(initialPos,sortedData);
2692 for (
unsigned int j = 0; j < numEvals; ++j) {
2693 (*sortedDataVecs [j])[i] = sortedData [j];
2694 (*cdfStaccVecs [j])[i] = cdfStaccs [j];
2695 (*cdfStaccVecsUp [j])[i] = cdfStaccsup [j];
2696 (*cdfStaccVecsLow[j])[i] = cdfStaccslow[j];
2703 template <
class V,
class M>
2706 unsigned int initialPos,
2707 const std::vector<V*>& evalPositionsVecs,
2708 std::vector<V*>& cdfStaccVecs)
const
2710 bool bRC = ((initialPos < this->subSequenceSize() ) &&
2711 (0 < evalPositionsVecs.size()) &&
2712 (evalPositionsVecs.size() == cdfStaccVecs.size() ));
2713 queso_require_msg(bRC,
"invalid input data");
2715 unsigned int numPos = this->subSequenceSize() - initialPos;
2718 unsigned int numEvals = evalPositionsVecs.size();
2719 for (
unsigned int j = 0; j < numEvals; ++j) {
2720 cdfStaccVecs[j] =
new V(m_vectorSpace.zeroVector());
2722 std::vector<double> evalPositions(numEvals,0.);
2723 std::vector<double> cdfStaccs (numEvals,0.);
2725 unsigned int numParams = this->vectorSizeLocal();
2726 for (
unsigned int i = 0; i < numParams; ++i) {
2727 this->extractScalarSeq(initialPos,
2733 for (
unsigned int j = 0; j < numEvals; ++j) {
2734 evalPositions[j] = (*evalPositionsVecs[j])[i];
2741 for (
unsigned int j = 0; j < numEvals; ++j) {
2742 (*cdfStaccVecs[j])[i] = cdfStaccs[j];
2748 #endif // #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
2754 #ifdef UQ_CODE_HAS_MONITORS
2755 template <
class V,
class M>
2759 m_subMeanMonitorPosSeq =
new ScalarSequence<double>(m_env, numberOfMonitorPositions,(m_name+
"_subMeanMonitorPosSeq").c_str());
2760 m_subMeanVecSeq =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_subMeanVecSeq").c_str() );
2761 m_subMeanCltStdSeq =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_subMeanCltStdSeq").c_str() );
2766 template <
class V,
class M>
2770 m_subMeanInter0MonitorPosSeq =
new ScalarSequence<double>(m_env, numberOfMonitorPositions,(m_name+
"_subMeanInter0MonitorPosSeq").c_str() );
2771 m_subMeanInter0Mean =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_subMeanInter0MeanSeq").c_str() );
2772 m_subMeanInter0Clt95 =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_subMeanInter0Clt95Seq").c_str() );
2773 m_subMeanInter0Empirical90 =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_subMeanInter0Empirical90Seq").c_str());
2774 m_subMeanInter0Min =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_subMeanInter0MinSeq").c_str() );
2775 m_subMeanInter0Max =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_subMeanInter0MaxSeq").c_str() );
2780 template <
class V,
class M>
2784 m_unifiedMeanMonitorPosSeq =
new ScalarSequence<double>(m_env, numberOfMonitorPositions,(m_name+
"_unifiedMeanMonitorPosSeq").c_str());
2785 m_unifiedMeanVecSeq =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_unifiedMeanVecSeq").c_str() );
2786 m_unifiedMeanCltStdSeq =
new SequenceOfVectors<V,M>(m_vectorSpace,numberOfMonitorPositions,(m_name+
"_unifiedMeanCltStdSeq").c_str() );
2791 template <
class V,
class M>
2797 this->subMeanExtra(0,
2801 this->subMeanCltStd(0,
2809 template <
class V,
class M>
2812 V& subMeanInter0Mean,
2813 V& subMeanInter0Clt95,
2814 V& subMeanInter0Empirical90,
2815 V& subMeanInter0Min,
2816 V& subMeanInter0Max)
2818 V subMeanVec(m_vectorSpace.zeroVector());
2819 this->subMeanExtra(0,
2823 subMeanVec.mpiAllReduce(RawValue_MPI_SUM,m_env.inter0Comm(),subMeanInter0Mean);
2824 subMeanInter0Mean /= ((double) m_env.inter0Comm().NumProc());
2826 V subMeanInter0CltVariance = subMeanVec-subMeanInter0Mean;
2827 subMeanInter0CltVariance *= subMeanInter0CltVariance;
2828 subMeanInter0CltVariance.mpiAllReduce(RawValue_MPI_SUM,m_env.inter0Comm(),subMeanInter0Clt95);
2829 subMeanInter0Clt95 /= ((double) (m_env.inter0Comm().NumProc()-1));
2830 subMeanInter0Clt95 /= ((double) (m_env.inter0Comm().NumProc()-1));
2831 subMeanInter0Clt95.cwSqrt();
2832 subMeanInter0Clt95 *= 3.;
2834 V subMeanInter0Quantile5(m_vectorSpace.zeroVector());
2835 subMeanVec.mpiAllQuantile(.05,m_env.inter0Comm(),subMeanInter0Quantile5);
2836 V subMeanInter0Quantile95(m_vectorSpace.zeroVector());
2837 subMeanVec.mpiAllQuantile(.95,m_env.inter0Comm(),subMeanInter0Quantile95);
2838 subMeanInter0Empirical90 = subMeanInter0Quantile95 - subMeanInter0Quantile5;
2840 subMeanVec.mpiAllReduce(RawValue_MPI_MIN,m_env.inter0Comm(),subMeanInter0Min);
2842 subMeanVec.mpiAllReduce(RawValue_MPI_MAX,m_env.inter0Comm(),subMeanInter0Max);
2847 template <
class V,
class M>
2851 V& unifiedMeanCltStd)
2853 this->unifiedMeanExtra(0,
2857 this->unifiedMeanCltStd(0,
2864 template <
class V,
class M>
2867 unsigned int monitorPosition,
2868 const V& subMeanVec,
2869 const V& subMeanCltStd)
2871 (*m_subMeanMonitorPosSeq)[i] = monitorPosition;
2872 m_subMeanVecSeq->setPositionValues(i,subMeanVec);
2873 m_subMeanCltStdSeq->setPositionValues(i,subMeanCltStd);
2878 template <
class V,
class M>
2881 unsigned int monitorPosition,
2882 const V& subMeanInter0Mean,
2883 const V& subMeanInter0Clt95,
2884 const V& subMeanInter0Empirical90,
2885 const V& subMeanInter0Min,
2886 const V& subMeanInter0Max)
2888 (*m_subMeanInter0MonitorPosSeq)[i] = monitorPosition;
2889 m_subMeanInter0Mean->setPositionValues(i,subMeanInter0Mean);
2890 m_subMeanInter0Clt95->setPositionValues(i,subMeanInter0Clt95);
2891 m_subMeanInter0Empirical90->setPositionValues(i,subMeanInter0Empirical90);
2892 m_subMeanInter0Min->setPositionValues(i,subMeanInter0Min);
2893 m_subMeanInter0Max->setPositionValues(i,subMeanInter0Max);
2898 template <
class V,
class M>
2901 unsigned int monitorPosition,
2903 V& unifiedMeanCltStd)
2905 (*m_unifiedMeanMonitorPosSeq)[i] = monitorPosition;
2906 m_unifiedMeanVecSeq->setPositionValues(i,unifiedMeanVec);
2907 m_unifiedMeanCltStdSeq->setPositionValues(i,unifiedMeanCltStd);
2912 template <
class V,
class M>
2916 m_subMeanMonitorPosSeq->subWriteContents(0,m_subMeanMonitorPosSeq->subSequenceSize(),ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2917 m_subMeanVecSeq->subWriteContents (0,m_subMeanVecSeq->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2918 m_subMeanCltStdSeq->subWriteContents (0,m_subMeanCltStdSeq->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2923 template <
class V,
class M>
2927 m_subMeanInter0MonitorPosSeq->subWriteContents(0,m_subMeanInter0MonitorPosSeq->subSequenceSize(),ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2928 m_subMeanInter0Mean->subWriteContents (0,m_subMeanInter0Mean->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2929 m_subMeanInter0Clt95->subWriteContents (0,m_subMeanInter0Clt95->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2930 m_subMeanInter0Empirical90->subWriteContents (0,m_subMeanInter0Empirical90->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2931 m_subMeanInter0Min->subWriteContents (0,m_subMeanInter0Min->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2932 m_subMeanInter0Max->subWriteContents (0,m_subMeanInter0Max->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2937 template <
class V,
class M>
2943 m_unifiedMeanMonitorPosSeq->subWriteContents(0,m_unifiedMeanMonitorPosSeq->subSequenceSize(),ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2944 m_unifiedMeanVecSeq->subWriteContents (0,m_unifiedMeanVecSeq->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2945 m_unifiedMeanCltStdSeq->subWriteContents (0,m_unifiedMeanCltStdSeq->subSequenceSize(), ofs,UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT);
2950 template <
class V,
class M>
2954 delete m_subMeanMonitorPosSeq;
2955 m_subMeanMonitorPosSeq = NULL;
2956 delete m_subMeanVecSeq;
2957 m_subMeanVecSeq = NULL;
2958 delete m_subMeanCltStdSeq;
2959 m_subMeanCltStdSeq = NULL;
2964 template <
class V,
class M>
2968 delete m_subMeanInter0MonitorPosSeq;
2969 m_subMeanInter0MonitorPosSeq = NULL;
2970 delete m_subMeanInter0Mean;
2971 m_subMeanInter0Mean = NULL;
2972 delete m_subMeanInter0Clt95;
2973 m_subMeanInter0Clt95 = NULL;
2974 delete m_subMeanInter0Empirical90;
2975 m_subMeanInter0Empirical90 = NULL;
2976 delete m_subMeanInter0Min;
2977 m_subMeanInter0Min = NULL;
2978 delete m_subMeanInter0Max;
2979 m_subMeanInter0Max = NULL;
2984 template <
class V,
class M>
2988 delete m_unifiedMeanMonitorPosSeq;
2989 m_unifiedMeanMonitorPosSeq = NULL;
2990 delete m_unifiedMeanVecSeq;
2991 m_unifiedMeanVecSeq = NULL;
2992 delete m_unifiedMeanCltStdSeq;
2993 m_unifiedMeanCltStdSeq = NULL;
2997 #endif // #ifdef UQ_CODE_HAS_MONITORS
void meanStacc(unsigned int initialPos, V &meanStaccVec) const
void subMeanMonitorFree()
T unifiedScaleForKde(bool useOnlyInter0Comm, unsigned int initialPos, const T &unifiedIqrValue, unsigned int kdeDimension) const
Selects the scales (bandwidth) for the kernel density estimation, considering the unified sequence...
Class to accommodate arrays of one-dimensional grid.
void subMeanInter0MonitorFree()
void unifiedMeanCltStd(unsigned int initialPos, unsigned int numPos, const V &unifiedMeanVec, V &unifiedSamVec) const
void copy(const BaseVectorSequence< V, M > &src)
Copies vector sequence src to this.
T subInterQuantileRange(unsigned int initialPos) const
Returns the interquartile range of the values in the sub-sequence.
void unifiedMeanMonitorFree()
void resizeSequence(unsigned int newSequenceSize)
Resizes the size of the sequence of scalars.
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...
T unifiedMeanExtra(bool useOnlyInter0Comm, unsigned int initialPos, unsigned int localNumPos) const
Finds the mean value of the unified sequence of numPos positions starting at position initialPos...
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.
T subMeanExtra(unsigned int initialPos, unsigned int numPos) const
Finds the mean value of the sub-sequence, considering numPos positions starting at position initialPo...
T unifiedSampleVarianceExtra(bool useOnlyInter0Comm, unsigned int initialPos, unsigned int localNumPos, const T &unifiedMeanValue) const
Finds the sample variance of the unified sequence, considering numPos positions starting at position ...
void geweke(unsigned int initialPos, double ratioNa, double ratioNb, V &gewVec) const
void unifiedGaussian1dKde(bool useOnlyInter0Comm, unsigned int initialPos, double unifiedScaleValue, const std::vector< T > &unifiedEvaluationPositions, std::vector< double > &unifiedDensityValues) const
Gaussian kernel for the KDE estimate of the unified sequence.
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 unifiedCdfPercentageRange(bool useOnlyInter0Comm, unsigned int initialPos, unsigned int numPos, double range, T &lowerValue, T &upperValue) const
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...
T unifiedSampleStd(bool useOnlyInter0Comm, unsigned int initialPos, unsigned int localNumPos, const T &unifiedMeanValue) const
Finds the sample standard deviation of the unified sequence, considering localnumPos positions starti...
T subScaleForKde(unsigned int initialPos, const T &iqrValue, unsigned int kdeDimension) const
Selects the scales (output value) for the kernel density estimation, considering only the sub-sequenc...
T unifiedPopulationVariance(bool useOnlyInter0Comm, unsigned int initialPos, unsigned int numPos, const T &unifiedMeanValue) const
Finds the population variance of the unified sequence, considering numPos positions starting at posit...
T unifiedMeanCltStd(bool useOnlyInter0Comm, unsigned int initialPos, unsigned int localNumPos, const T &unifiedMeanValue) const
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 setOneDTable(unsigned int rowId, const std::vector< double > &values)
Sets the one-dimensional table.
T unifiedMedianExtra(bool useOnlyInter0Comm, unsigned int initialPos, unsigned int localNumPos) const
Finds the median value of the unified sequence, considering numPos positions starting at position ini...
void subUniformlySampledMdf(const V &numEvaluationPointsVec, ArrayOfOneDGrids< V, M > &mdfGrids, ArrayOfOneDTables< V, M > &mdfValues) const
void subHistogram(unsigned int initialPos, const T &minHorizontalValue, const T &maxHorizontalValue, std::vector< T > ¢ers, std::vector< unsigned int > &bins) const
Calculates the histogram of the sub-sequence.
void unifiedCdfPercentageRange(unsigned int initialPos, unsigned int numPos, double range, V &lowerVec, V &upperVec) const
void autoCorrViaFft(unsigned int initialPos, unsigned int numPos, unsigned int maxLag, std::vector< T > &autoCorrs) const
Calculates the autocorrelation via Fast Fourier transforms (FFT).
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.
void psd(unsigned int initialPos, unsigned int numBlocks, double hopSizeRatio, std::vector< double > &psdSequence) const
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 deleteStoredVectors()
Deletes all the stored vectors.
void unifiedInterQuantileRange(unsigned int initialPos, V &unifiedIqrVec) const
Returns the interquartile range of the values in the unified sequence.
void subCdfStacc(unsigned int initialPos, std::vector< double > &cdfStaccValues, std::vector< double > &cdfStaccValuesup, std::vector< double > &cdfStaccValueslow, const ScalarSequence< T > &sortedDataValues) const
void setPositionValues(unsigned int posId, const V &vec)
Set the values in vec at position posId of the sequence.
void subMeanMonitorStore(unsigned int i, unsigned int monitorPosition, const V &subMeanVec, const V &subMeanCltStd)
void unifiedMeanMonitorAlloc(unsigned int numberOfMonitorPositions)
T subPopulationVariance(unsigned int initialPos, unsigned int numPos, const T &meanValue) const
Finds the population variance of the sub-sequence, considering numPos positions starting at position ...
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
void unifiedHistogram(bool useOnlyInter0Comm, unsigned int initialPos, const T &unifiedMinHorizontalValue, const T &unifiedMaxHorizontalValue, std::vector< T > &unifiedCenters, std::vector< unsigned int > &unifiedBins) const
Calculates the histogram of the unified sequence.
Class for handling vector samples (sequence of vectors).
void subMinMaxExtra(unsigned int initialPos, unsigned int numPos, T &minValue, T &maxValue) const
Finds the minimum and the maximum values of the sub-sequence, considering numPos positions starting a...
void extractScalarSeq(unsigned int initialPos, unsigned int spacing, unsigned int numPos, unsigned int paramId, ScalarSequence< double > &scalarSeq) const
Extracts a sequence of scalars.
void setUniformGrids(const V &sizesVec, const V &minPositionsVec, const V &maxPositionsVec)
Sets an array of uniform grids.
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...
T autoCovariance(unsigned int initialPos, unsigned int numPos, const T &meanValue, unsigned int lag) const
Calculates the autocovariance.
void writeTxtHeader(std::ofstream &ofs, double sequenceSize, double vectorSizeLocal) const
Helper function to write plain txt info for vectors.
std::vector< const V * >::iterator seqVectorPositionIteratorTypedef
void unifiedMinMaxExtra(bool useOnlyInter0Comm, unsigned int initialPos, unsigned int numPos, T &unifiedMinValue, T &unifiedMaxValue) const
Finds the minimum and the maximum values of the unified sequence, considering numPos positions starti...
void subCdfPercentageRange(unsigned int initialPos, unsigned int numPos, double range, V &lowerVec, V &upperVec) const
std::ifstream * ifsVar
Provides a stream interface to read data from files.
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)
T unifiedInterQuantileRange(bool useOnlyInter0Comm, unsigned int initialPos) const
Returns the interquartile range of the values in the unified sequence.
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.
T bmm(unsigned int initialPos, unsigned int batchLength) const
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.
GslMatrix matrixProduct(const GslVector &v1, const GslVector &v2)
void subGaussian1dKde(unsigned int initialPos, double scaleValue, const std::vector< T > &evaluationPositions, std::vector< double > &densityValues) const
Gaussian kernel for the KDE estimate of the sub-sequence.
MonteCarloSGOptions::MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix, const McOptionsValues &alternativeOptionsValues queso_require_equal_to_msg)(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the existence of an options input file"))
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.
T subMeanCltStd(unsigned int initialPos, unsigned int numPos, const T &meanValue) const
void subSort(unsigned int initialPos, ScalarSequence< T > &sortedSequence) const
Sorts the sub-sequence of scalars.
T subMedianExtra(unsigned int initialPos, unsigned int numPos) const
Finds the median value of the sub-sequence, considering numPos positions starting at position initial...
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.
T meanStacc(unsigned int initialPos) const
void unifiedMeanMonitorRun(unsigned int currentPosition, V &unifiedMeanVec, V &unifiedMeanCltStd)
T autoCorrViaDef(unsigned int initialPos, unsigned int numPos, unsigned int lag) const
Calculates the autocorrelation via definition.
T subSampleStd(unsigned int initialPos, unsigned int numPos, const T &meanValue) const
Finds the sample standard deviation of the unified sequence, considering numPos positions starting at...
void subMeanInter0MonitorWrite(std::ofstream &ofs)
double estimateConvBrooksGelman(unsigned int initialPos, unsigned int numPos) const
Estimates convergence rate using Brooks & Gelman method.
void subCdfPercentageRange(unsigned int initialPos, unsigned int numPos, double range, T &lowerValue, T &upperValue) const
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.
std::ofstream * ofsVar
Provides a stream interface to write data to files.
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 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 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...
Struct for handling data input and output from files.
void bmm(unsigned int initialPos, unsigned int batchLength, V &bmmVec) const
void subMeanMonitorWrite(std::ofstream &ofs)
T geweke(unsigned int initialPos, double ratioNa, double ratioNb) const
double MiscGetEllapsedSeconds(struct timeval *timeval0)
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
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
T subSampleVarianceExtra(unsigned int initialPos, unsigned int numPos, const T &meanValue) const
Finds the sample variance of the sub-sequence, considering numPos positions starting at position init...
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...