55 maxValue=
new(std::nothrow) std::pair<double,double>;
57 std::cerr <<
"OUT OF MEMORY\nFile" << __FILE__ <<
"Line:\t"<< __LINE__ << std::endl;
70 minValue=
new(std::nothrow) std::pair<double,double>;
72 std::cerr <<
"OUT OF MEMORY\nFile" << __FILE__ <<
"Line:\t"<< __LINE__ << std::endl;
96 void weight::setWeights( std::vector<double>& xVals, std::vector<double>& yVals, std::pair<double,double>* xMin, std::pair<double,double>* xMax ){
102 vals=
new(std::nothrow) std::vector<std::pair<double,double> >;
104 std::cerr <<
"OUT OF MEMORY\nFile" << __FILE__ <<
"Line:\t"<< __LINE__ << std::endl;
108 if (xVals.size()!=yVals.size()){
109 std::cerr <<
"X-Y values are not the same size." <<std::endl;
113 for(
size_t i=0;i<xVals.size();i++){
114 std::pair<double,double> xy (xVals[i],yVals[i]);
121 bool compXval(
const std::pair<double,double>& a,
const std::pair<double,double>& b){
122 return (a.first<b.first);
139 else if (
maxValue!=NULL && score < minValue->first){
143 std::vector<std::pair<double,double> >::iterator it;
145 std::pair<double,double> temp (score,0);
151 if ((*it).first==score){
154 else if (it==
vals->begin()){
157 else if (it==
vals->end()){
167 std::string scaleString;
170 scaleString+=
"\tVALUE:\tLOG\t[";
171 for(
size_t i=0;i<
vals->size();i++){
179 scaleString+=
"\tSCALED:\tLOG\t[";
180 for(
size_t i=0;i<
vals->size();i++){
206 std::vector<double> xVal;
207 std::vector<double> yVal;
217 for(
size_t i=0;i<lst.
size();i++){
222 std::cerr <<
"Unable to parse weight line: " << lst[i] << std::endl;
226 if (line[0].compare(
"SCALE")==0){
231 std::cerr <<
"Weight Scale is missing a name" << std::endl;
235 else if (line[0].compare(
"ABSOLUTE")==0){
237 std::cerr <<
"Weight Absolute value is missing " << std::endl;
244 std::cerr <<
"Weighted Absoolute value not numeric: " << line[1] << std::endl;
251 else if (line[0].compare(
"VALUE")==0){
254 std::cerr <<
"Weight VALUE line is missing values" << std::endl;
258 bool px=line[1].compare(
"P(X)")==0;
259 for(
size_t i=2;i<line.
size();i++){
263 std::cerr <<
"Weighted VALUE not numeric: " << line[i] << std::endl;
271 xVal.push_back(tempValue);
276 else if (line[0].compare(
"SCALED")==0){
279 std::cerr <<
"Weight SCALED line is missing values" << std::endl;
283 bool px = line[1].compare(
"P(X)")==0;
284 for(
size_t i=2;i<line.
size();i++){
288 std::cerr <<
"Weighted SCALED value not numeric: " << line[i] << std::endl;
296 yVal.push_back(tempValue);
301 else if (line[0].compare(
"MIN_VALUE")==0){
304 std::cerr <<
"Weight MIN_VALUE line is missing values" << std::endl;
310 std::cerr <<
"Weighted VALUE not numeric: " << line[i] << std::endl;
315 if (line[1].compare(
"P(X)")==0){
316 minXVal=log(tempValue);
323 else if (line[0].compare(
"MIN_SCALED")==0){
326 std::cerr <<
"Weight MIN_SCALED line is missing values" << std::endl;
332 std::cerr <<
"Weighted MIN_SCALED value not numeric: " << line[i] << std::endl;
338 if (line[1].compare(
"P(X)")==0){
339 minYVal=log(tempValue);
348 else if (line[0].compare(
"MAX_VALUE")==0){
352 std::cerr <<
"Weight MAX_VALUE line is missing values" << std::endl;
358 std::cerr <<
"Weighted MAX_VALUE value not numeric: " << line[i] << std::endl;
364 if (line[1].compare(
"P(X)")==0){
365 maxXVal=log(tempValue);
372 else if (line[0].compare(
"MAX_SCALED")==0){
375 std::cerr <<
"Weight MAX_SCALED line is missing values" << std::endl;
381 std::cerr <<
"Weighted MAX_SCALED value not numeric: " << line[i] << std::endl;
386 if (line[1].compare(
"P(X)")==0){
387 maxYVal=log(tempValue);
397 if (table && (yVal.size()==xVal.size())){
401 std::cerr <<
"Scaling Values entries don't match up. They are of different sizes" <<std::endl;
420 std::string& name=wt->
getName();
421 if (!
wts.count(name)){
426 std::cerr <<
"Weight of name: " << name <<
" already exists and is duplicated. Please remove duplicates.\n";
432 if (
wts.count(name)){
445 std::string weightString;
446 std::string lnSep(50,
'=');
448 weightString+=
"SCALING FUNCTIONS\n" + lnSep +
"\n";
449 std::map<std::string,weight*>::iterator it;
450 for(it=
wts.begin();it!=
wts.end();it++){
451 weightString+=
"SCALE:\t" + (*it).first +
"\n";
452 weightString+=(*it).second->stringify();