src/ModelParameterInfoTypes.cpp
dvector DevsVectorInfo::jitterInitVals(random_number_generator& rng, double jitFrac){
    if (debug){
        rpt::echo<<"--in DevsVectorInfo::jitterInitVals"<<endl;
        rpt::echo<<"initVals   = "<<initVals<<endl;
    }
    dvector vp = 1.0*initVals;
    if (phase>0){
        if (debug) rpt::echo<<"lower = "<<lower<<tb<<"upper = "<<upper<<endl;
        vp = BoundedVectorInfo::jitterInitVals(rng,jitFrac);
        if (debug) rpt::echo<<"vp         = "<<vp<<endl;
        vp -= mean(vp);//ensure sum of devs = 0
        if (debug) rpt::echo<<"vp-mean(vp) = "<<vp<<endl<<"sum(vpp) = "<<sum(vp)<<endl;
        if (max(fabs(vp))>max(fabs(lower),fabs(upper))) {
            double rescl = max(fabs(lower),fabs(upper))/max(fabs(vp));
            if (debug) rpt::echo<<"rescaling using "<<rescl<<endl;
            vp *= rescl;//rescale to within bounds
        }        
    }
    if (debug) {
        rpt::echo<<"final vp = "<<vp<<endl;
        rpt::echo<<"------------"<<endl;
    }
    return vp;
}
/**
 * Draws a vector of jittered random values on the arithmetic scale based on the 
 * bounds set and the fraction of the range to jitter (jitFrac).
 * 
 * Note that this DOES NOT update initVals.
 * If the estimation phase is \< 0, the value of initVals is returned
 * 
 * @param rng - the random number generator
 * @param jitFrac - the fraction of the range across which to jitter
 * 
 * @return - the vector of jittered values on the arithmetic scale, or the value of initVals
 */
Draws a vector of jittered random values on the arithmetic scale based on the
bounds set and the fraction of the range to jitter (jitFrac).

Note that this DOES NOT update initVals.
If the estimation phase is \< 0, the value of initVals is returned

@param rng - the random number generator
@param jitFrac - the fraction of the range across which to jitter

@return - the vector of jittered values on the arithmetic scale, or the value of initVals
Draws a vector of jittered random values on the arithmetic scale based on the bounds set and the fraction of the range to jitter ( jitFrac ) . Note that this DOES NOT update initVals . If the estimation phase is \ < 0 the value of initVals is returned @param rng - the random number generator @param jitFrac - the fraction of the range across which to jitter @return - the vector of jittered values on the arithmetic scale or the value of initVals
dvector DevsVectorInfo::jitterInitVals(random_number_generator& rng, double jitFrac){
    if (debug){
        rpt::echo<<"--in DevsVectorInfo::jitterInitVals"<<endl;
        rpt::echo<<"initVals   = "<<initVals<<endl;
    }
    dvector vp = 1.0*initVals;
    if (phase>0){
        if (debug) rpt::echo<<"lower = "<<lower<<tb<<"upper = "<<upper<<endl;
        vp = BoundedVectorInfo::jitterInitVals(rng,jitFrac);
        if (debug) rpt::echo<<"vp         = "<<vp<<endl;
        vp -= mean(vp);
        if (debug) rpt::echo<<"vp-mean(vp) = "<<vp<<endl<<"sum(vpp) = "<<sum(vp)<<endl;
        if (max(fabs(vp))>max(fabs(lower),fabs(upper))) {
            double rescl = max(fabs(lower),fabs(upper))/max(fabs(vp));
            if (debug) rpt::echo<<"rescaling using "<<rescl<<endl;
            vp *= rescl;
        }        
    }
    if (debug) {
        rpt::echo<<"final vp = "<<vp<<endl;
        rpt::echo<<"------------"<<endl;
    }
    return vp;
}
dvector DevsVectorInfo :: jitterInitVals ( random_number_generator & rng , double jitFrac ) { if ( debug ) { rpt :: echo << " " << endl ; rpt :: echo << " " << initVals << endl ; } dvector vp = 1.0 * initVals ; if ( phase > 0 ) { if ( debug ) rpt :: echo << " " << lower << tb << " " << upper << endl ; vp = BoundedVectorInfo :: jitterInitVals ( rng , jitFrac ) ; if ( debug ) rpt :: echo << " " << vp << endl ; vp -= mean ( vp ) ; if ( debug ) rpt :: echo << " " << vp << endl << " " << sum ( vp ) << endl ; if ( max ( fabs ( vp ) ) > max ( fabs ( lower ) , fabs ( upper ) ) ) { double rescl = max ( fabs ( lower ) , fabs ( upper ) ) / max ( fabs ( vp ) ) ; if ( debug ) rpt :: echo << " " << rescl << endl ; vp *= rescl ; } } if ( debug ) { rpt :: echo << " " << vp << endl ; rpt :: echo << " " << endl ; } return vp ; }
Draws a vector of jittered random values on the arithmetic scale based on the
 bounds set and the fraction of the range to jitter (jitFrac).
Draws a vector of jittered random values on the arithmetic scale based on the bounds set and the fraction of the range to jitter ( jitFrac ) .
//ensure sum of devs = 0 //rescale to within bounds