From the results of a UScale run, calculate the best-fit scaling equation
@param scale the results to analyze
@return the best-fit scaling equation.
495767
public static MathEquation detect(UScale scale) {
        return Arrays.stream(rank(scale))
                .filter(eq -> eq.isValid())
                .findFirst()
                .orElse(fit(scale, Models.CONSTANT)); // if no valid is found, it is because of constant data
    }
326047
private boolean doSetScale(double scale) {
		boolean res = Math.abs(viewState.getScale() - scale) > .0000001;
		viewState = viewState.copyAndSetScale(scale);
		return res;
	}
585747
private DataPoints scale(final DataPoints points, final double scale_factor) {
    // TODO(cl) - Using an array as the size function may not return the exact
    // results and we should figure a way to avoid copying data anyway.
    final List<DataPoint> dps = new ArrayList<DataPoint>();
    final boolean scale_is_int = (scale_factor == Math.floor(scale_factor)) && 
        !Double.isInfinite(scale_factor);
    final SeekableView view = points.iterator();
    while (view.hasNext()) {
      DataPoint pt = view.next();
      if (pt.isInteger() && scale_is_int) {
        dps.add(MutableDataPoint.ofLongValue(pt.timestamp(), 
            (long)scale_factor * pt.longValue()));
      } else {
        // NaNs are fine here, they'll just be re-computed as NaN
        dps.add(MutableDataPoint.ofDoubleValue(pt.timestamp(), 
            scale_factor * pt.toDouble()));
      }
    }
    final DataPoint[] results = new DataPoint[dps.size()];
    dps.toArray(results);
    return new PostAggregatedDataPoints(points, results);
  }
670173
public Integer getScale()
   {
      if(childNode.getAttribute("scale") != null && !childNode.getAttribute("scale").equals("null"))
      {
         return Integer.valueOf(childNode.getAttribute("scale"));
      }
      return null;
   }
424693
private Double scale(Double value, Double maxAbsolute) {
        if(maxAbsolute.equals(0.0)) {
            return Math.signum(value);
        }
        else {
            return value/maxAbsolute;
        }
    }
1150135
def get_scaled(self, factor):
        
        res = TimeUnit(self)
        res._factor = self._factor * factor
        res._unit = self._unit
        return res
573812
public static int pixelXToTileXWithScaleFactor(double pixelX, double scaleFactor, int tileSize) {
        return (int) Math.min(Math.max(pixelX / tileSize, 0), scaleFactor - 1);
    }
383910
function determineUnitForFormatting(scale, ticks, minUnit, min, max) {
	var ilen = UNITS.length;
	var i, unit;

	for (i = ilen - 1; i >= UNITS.indexOf(minUnit); i--) {
		unit = UNITS[i];
		if (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= ticks.length) {
			return unit;
		}
	}

	return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];
}
4339
public Matrix4 setToScale (IVector3 scale) {
        return setToScale(scale.x(), scale.y(), scale.z());
    }
432724
public void scale(double s, Vector3d v1) {
        x = s * v1.x;
        y = s * v1.y;
        z = s * v1.z;
    }
1339147
public static void scaleDownToFit( Rectangle2D rectToFitIn, Rectangle2D toScale ) {
        double fitWidth = rectToFitIn.getWidth();
        double fitHeight = rectToFitIn.getHeight();

        double toScaleWidth = toScale.getWidth();
        double toScaleHeight = toScale.getHeight();

        if (toScaleWidth > fitWidth) {
            double factor = toScaleWidth / fitWidth;
            toScaleWidth = fitWidth;
            toScaleHeight = toScaleHeight / factor;
        }
        if (toScaleHeight > fitHeight) {
            double factor = toScaleHeight / fitHeight;
            toScaleHeight = fitHeight;
            toScaleWidth = toScaleWidth / factor;
        }
        toScale.setRect(0, 0, toScaleWidth, toScaleHeight);
    }
799969
public String explainScore(StringWrapper s,StringWrapper t) 
	{
		if (scaling) {
			int minLen = Math.min( s.unwrap().length(), t.unwrap().length() );
			double scaledDist =  super.score(s,t) / (minLen * CHAR_EXACT_MATCH_SCORE);
			return super.explainScore(s,t)
				+ "\nScaling factor: "+(minLen*CHAR_EXACT_MATCH_SCORE) 
				+ "\nScaled score: "+scaledDist;
		} else {
			return super.explainScore(s,t);
		}
	}
641864
def scaledBy(self, scale):
        
        scaled = deepcopy(self)
    
        for test in scaled.elements[0].tests:
            if type(test.value) in (int, float):
                if test.property == 'scale-denominator':
                    test.value /= scale
                elif test.property == 'zoom':
                    test.value += log(scale)/log(2)
        
        return scaled
489672
public double score(StringWrapper s,StringWrapper t) {
		if (scaling) {
			int minLen = Math.min( s.unwrap().length(), t.unwrap().length() );
			return super.score(s,t) / (minLen * CHAR_EXACT_MATCH_SCORE);
		} else {
			return super.score(s,t);
		}
	}
719628
@SuppressWarnings("unchecked")
  public static <E, C extends Counter<E>> C scale(C c, double s) {
    C scaled = (C) c.getFactory().create();
    for (E key : c.keySet()) {
      scaled.setCount(key, c.getCount(key) * s);
    }
    return scaled;
  }
421281
private float calculateScale(int x, int y) {
		final float centerX = getWidth() / 2f;
		final float centerY = getHeight() / 2f;
		final float maxDistance = (float) Math.sqrt(centerX * centerX + centerY * centerY);

		final float deltaX = centerX - x;
		final float deltaY = centerY - y;
		final float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
		final float scale = 0.5f + (distance / maxDistance) * 0.5f;
		return scale;
	}
866703
public function exp(int $scale = null): Decimal
    {
        if ($this->isZero()) {
            return DecimalConstants::one();
        }

        $scale = $scale ?? \max(
            $this->scale,
            (int)($this->isNegative() ? self::innerLog10($this->value, $this->scale, 0) : self::DEFAULT_SCALE)
        );

        return self::factorialSerie(
            $this, DecimalConstants::one(), function ($i) { return DecimalConstants::one(); }, $scale
        );
    }