Changeset 158
 Timestamp:
 03/01/14 22:40:49 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

cpp/frams/genetics/oper_fx.cpp
r146 r158 155 155 void GenoOperators::linearMix(ParamInterface &p1, int i1, ParamInterface &p2, int i2, double proportion) 156 156 { 157 if (p1.type(i1)[0] == 'f' && p2.type(i2)[0] == 'f') 157 char type1 = p1.type(i1)[0]; 158 char type2 = p2.type(i2)[0]; 159 if (type1 == 'f' && type2 == 'f') 158 160 { 159 161 double v1 = p1.getDouble(i1); … … 162 164 p2.setDouble(i2, v2*proportion + v1*(1  proportion)); 163 165 } 164 if (p1.type(i1)[0] == 'd' && p2.type(i2)[0] == 'd') 165 { 166 int v1 = p1.getInt(i1); 167 int v2 = p2.getInt(i2); 168 setIntFromDoubleWithProbabilisticDithering(p1, i1, v1*proportion + v2*(1  proportion)); 169 setIntFromDoubleWithProbabilisticDithering(p2, i2, v2*proportion + v1*(1  proportion)); 170 } 166 else 167 if (type1 == 'd' && type2 == 'd') 168 { 169 int v1 = p1.getInt(i1); 170 int v2 = p2.getInt(i2); 171 setIntFromDoubleWithProbabilisticDithering(p1, i1, v1*proportion + v2*(1  proportion)); 172 setIntFromDoubleWithProbabilisticDithering(p2, i2, v2*proportion + v1*(1  proportion)); 173 } 174 else 175 FMprintf("GenoOperators", "linearMix", FMLV_WARN, "Cannot mix values of types '%c' and '%c'", type1, type2); 171 176 } 172 177 … … 241 246 242 247 void GenoOperators::skipWS(char *&s) 243 { if (!s) FramMessage("GenoOperators","skipWS","NULL reference!",1); else 244 while (isWS(*s)) s++; 248 { 249 if (s==NULL) 250 FramMessage("GenoOperators", "skipWS", "NULL reference!", FMLV_WARN); 251 else 252 while (isWS(*s)) s++; 245 253 } 246 254
Note: See TracChangeset
for help on using the changeset viewer.