146 int size = atoi((*beg).c_str());
148 std::vector<bool> lines;
150 boost::char_separator<char>sep(
" \t");
151 for (
int i = 0; i < size; i++) {
152 IsEOF = getline(ifile, line).eof();
153 if (line.empty() || line.at(0) ==
'#') {
154 if (rank == 0)
throw std::runtime_error(
"ERROR: no comments or empty lines in CorrelatedGaussianParameters please! In line no." + boost::lexical_cast<std::string>(lineNo) +
" of file " + filename);
158 boost::tokenizer<boost::char_separator<char> > tok(line, sep);
160 std::string type = *beg;
162 if (type.compare(
"ModelParameter") != 0) {
163 if (rank == 0)
throw std::runtime_error(
"ERROR: in line no." + boost::lexical_cast<std::string>(lineNo) +
" of file " + filename +
", expecting a ModelParameter type here...\n");
168 lines.push_back(!tmpMP.
IsFixed());
169 if (beg != tok.end())
170 if (rank == 0) std::cout <<
"WARNING: unread information in parameter " << tmpMP.
getname() << std::endl;
176 ModPars.push_back(tmpMP);
180 TMatrixD myCorr(nlines, nlines);
182 for (
int i = 0; i < size; i++) {
183 IsEOF = getline(ifile, line).eof();
184 if (line.empty() || line.at(0) ==
'#') {
185 if (rank == 0)
throw std::runtime_error(
"ERROR: no comments or empty lines in CorrelatedGaussianParameters please! In line no." + boost::lexical_cast<std::string>(lineNo) +
" of file " + filename);
190 boost::tokenizer<boost::char_separator<char> > mytok(line, sep);
193 for (
int j = 0; j < size; j++) {
194 if ((*beg).compare(0, 1,
"0") == 0
195 || (*beg).compare(0, 1,
"1") == 0
196 || (*beg).compare(0, 1,
"-") == 0) {
197 if (std::distance(mytok.begin(), mytok.end()) < size) {
198 if (rank == 0)
throw std::runtime_error(
"ERROR: invalid correlation matrix for " +
name +
". Check element (" + boost::lexical_cast<std::string>(ni + 1) +
"," + boost::lexical_cast<std::string>(nj + 1) +
") in line number " + boost::lexical_cast<std::string>(lineNo) +
" in file " + filename +
".\n");
202 myCorr(ni, nj) = atof((*beg).c_str());
207 if (rank == 0) std::cout <<
"ERROR: invalid correlation matrix for "
208 <<
name <<
". Check element (" << ni + 1 <<
"," << nj + 1 <<
") in line number " + boost::lexical_cast<std::string>(lineNo) << std::endl;
215 if (!myCorr.IsSymmetric()) {
216 if (rank == 0) std::cout <<
"ERROR: invalid correlation matrix for "
217 <<
name <<
". Correlation matrix is not symmetric." << std::endl;
220 TMatrixDSym mySCorr(nlines);
221 for (
int i = 0; i < nlines; i++) {
222 for (
int j = 0; j <= i; j++) {
223 mySCorr(i, j) = myCorr(i, j);
224 mySCorr(j, i) = mySCorr(i, j);
231 if (rank == 0) std::cout <<
"\nWARNING: Correlated Gaussian Parameters " <<
name.c_str() <<
" defined with less than two correlated parameters. The set is being marked as normal Parameters." << std::endl;
233 for (
int i = 0; i < size; i++) {
234 IsEOF = getline(ifile, line).eof();
boost::tokenizer< boost::char_separator< char > >::iterator & ParseModelParameter(boost::tokenizer< boost::char_separator< char > >::iterator &beg)
Parser for model parameters.
void setCgp_name(std::string cgp_name)
A set method to set the name of the set of correlated parameter.
std::string getname() const
A get method to get the name of each parameter.
bool IsFixed() const
A method to check if the parameter is fixed.