Calculates the radius to a given boundedness value
@param D Diffusion coefficient
@param N Number of steps
@param timelag Timelag
@param B Boundedeness
@return Confinement radius
181508
public static double getRadiusToBoundedness(double D, int N, double timelag, double B){
		double cov_area = a(N)*D*timelag;
		double radius = Math.sqrt(cov_area/(4*B));
		return radius;
	}
1308399
def doublewell_eigs(n_grid, lag_time=1):
    
    return _brownian_eigs(n_grid, lag_time, DOUBLEWELL_GRAD_POTENTIAL,
                          -np.pi, np.pi, reflect_bc=True)
248013
public static void tql2(int n, double d[], double e[], double v[][]) {

    //  This is derived from the Algol procedures tql2, by
    //  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
    //  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
    //  Fortran subroutine in EISPACK.

    System.arraycopy(e, 1, e, 0, n - 1);
    e[n - 1] = 0.0;

    double f = 0.0;
    double tst1 = 0.0;
    double eps = Math.pow(2.0, -52.0);
    for (int l = 0; l < n; l++) {

      // Find small subdiagonal element

      tst1 = Math.max(tst1, Math.abs(d[l]) + Math.abs(e[l]));
      int m = l;
      while (m < n) {
        if (Math.abs(e[m]) <= eps * tst1) {
          break;
        }
        m++;
      }

      // If m == l, d[l] is an eigenvalue,
      // otherwise, iterate.

      if (m > l) {
        int iter = 0;
        do {
          iter = iter + 1;  // (Could check iteration count here.)

          // Compute implicit shift
          f += specificShift(l, n, d, e);

          // Implicit QL transformation.
          implicitQLTransformation(l, m, n, v, d, e);

          // Check for convergence.

        } while (Math.abs(e[l]) > eps * tst1);
      }
      d[l] = d[l] + f;
      e[l] = 0.0;
    }

    // Sort eigenvalues and corresponding vectors.
    sortEigenValues(n, d, v);

  }
324931
def _friends_leaveoneout_radius(points, ftype):
    """"""

    # Construct KDTree to enable quick nearest-neighbor lookup for
    # our resampled objects.
    kdtree = spatial.KDTree(points)

    if ftype == 'balls':
        # Compute radius to two nearest neighbors (self + neighbor).
        dists, ids = kdtree.query(points, k=2, eps=0, p=2)
    elif ftype == 'cubes':
        # Compute half-side-length to two nearest neighbors (self + neighbor).
        dists, ids = kdtree.query(points, k=2, eps=0, p=np.inf)

    dist = dists[:, 1]  # distances to LOO nearest neighbor

    return dist
1352256
private double preDistance(NumberVector v1, NumberVector v2, final int start, final int end) {
    double agg = 0.;
    for(int d = start; d < end; d++) {
      final double xd = v1.doubleValue(d), yd = v2.doubleValue(d);
      final double delta = xd >= yd ? xd - yd : yd - xd;
      agg += MathUtil.powi(delta, intp);
    }
    return agg;
  }
371053
public static Dcsd cs_dalloc(int m, int n) {
        Dcsd D;
        D = new Dcsd();
        D.p = new int[m];
        D.r = new int[m + 6];
        D.q = new int[n];
        D.s = new int[n + 6];
        D.cc = new int[5];
        D.rr = new int[5];
        return D;
    }
842337
protected void calculateBounds(float _Width, float _Margin) {
        float maxValue = 0;
        int   last     = 0;

        for (BarModel model : mData) {
            if(model.getValue() > maxValue) {
                maxValue = model.getValue();
            }
        }

        int valuePadding = mShowValues ? (int) mValuePaint.getTextSize() + mValueDistance : 0;

        float heightMultiplier = (mGraphHeight - valuePadding) / maxValue;

        for (BarModel model : mData) {
            float height = model.getValue() * heightMultiplier;
            last += _Margin / 2;
            model.setBarBounds(new RectF(last, mGraphHeight - height, last + _Width, mGraphHeight));
            model.setLegendBounds(new RectF(last, 0, last + _Width, mLegendHeight));
            last += _Width + (_Margin / 2);
        }

        Utils.calculateLegendInformation(mData, 0, mContentRect.width(), mLegendPaint);
    }
184289
public float getBoundsDepth() {
        if (mSceneObject != null) {
            GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume();
            return v.maxCorner.z - v.minCorner.z;
        }
        return 0f;
    }
8915
def calculate_localised_cost(self, d1, d2, neighbours, motions):
        
        my_nbrs_with_motion = [n for n in neighbours[d1] if n in motions]

        my_motion = (d1.center[0] - d2.center[0], d1.center[1] - d2.center[1])

        if my_nbrs_with_motion == []:
            distance = euclidean_dist(d1.center, d2.center) / self.scale
        else:
            # it is not in motions if there is no trace (cell is considered to vanish)
            distance = min([euclidean_dist(my_motion, motions[n]) for n in my_nbrs_with_motion]) / self.scale

        area_change = 1 - min(d1.area, d2.area) / max(d1.area, d2.area)

        return distance + self.parameters_cost_iteration["area_weight"] * area_change
829822
@Override
    public Rectangle calculateDiagramBounds(IChemModel model) {
        IAtomContainerSet moleculeSet = model.getMoleculeSet();
        IReactionSet reactionSet = model.getReactionSet();
        if ((moleculeSet == null && reactionSet == null)) {
            return new Rectangle();
        }

        Rectangle2D moleculeBounds = null;
        Rectangle2D reactionBounds = null;
        if (moleculeSet != null) {
            moleculeBounds = BoundsCalculator.calculateBounds(moleculeSet);
        }
        if (reactionSet != null) {
            reactionBounds = BoundsCalculator.calculateBounds(reactionSet);
        }

        if (moleculeBounds == null) {
            return this.calculateScreenBounds(reactionBounds);
        } else if (reactionBounds == null) {
            return this.calculateScreenBounds(moleculeBounds);
        } else {
            Rectangle2D allbounds = new Rectangle2D.Double();
            Rectangle2D.union(moleculeBounds, reactionBounds, allbounds);
            return this.calculateScreenBounds(allbounds);
        }
    }
557121
public Frame frId(int d, int n) {
    int idx = _display[_tod-d]+n;
    assert _ary[idx]!=null;
    return _ary[idx];
  }
347206
public static Double computeCompacity(Geometry geom) {
        if(geom == null){
            return null;
        }
        if (geom instanceof Polygon) {
            final double circleRadius = Math.sqrt(geom.getArea() / Math.PI);
            final double circleCurcumference = 2 * Math.PI * circleRadius;
            return circleCurcumference / geom.getLength();
        }
        return null;
    }
1168875
@Override
    public DescriptorValue calculate(IAtomContainer atomContainer) {
        wienerNumbers = new DoubleArrayResult(2);
        double wienerPathNumber = 0; //wienerPath
        double wienerPolarityNumber = 0; //wienerPol

        matr = ConnectionMatrix.getMatrix(AtomContainerManipulator.removeHydrogens(atomContainer));
        int[][] distances = PathTools.computeFloydAPSP(matr);

        int partial;
        for (int i = 0; i < distances.length; i++) {
            for (int j = 0; j < distances.length; j++) {
                partial = distances[i][j];
                wienerPathNumber += partial;
                if (partial == 3) {
                    wienerPolarityNumber += 1;
                }
            }
        }
        wienerPathNumber = wienerPathNumber / 2;
        wienerPolarityNumber = wienerPolarityNumber / 2;

        wienerNumbers.add(wienerPathNumber);
        wienerNumbers.add(wienerPolarityNumber);
        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), wienerNumbers,
                getDescriptorNames());
    }
485187
public static double diagProd( DMatrix1Row T )
    {
        double prod = 1.0;
        int N = Math.min(T.numRows,T.numCols);
        for( int i = 0; i < N; i++ ) {
            prod *= T.unsafe_get(i,i);
        }

        return prod;
    }
974699
protected static void sortBound (double[] bound, int bc) {
        for (int i = 0; i < bc - 4; i += 4) {
            int k = i;
            for (int j = i + 4; j < bc; j += 4) {
                if (bound[k] > bound[j]) {
                    k = j;
                }
            }
            if (k != i) {
                double tmp = bound[i];
                bound[i] = bound[k];
                bound[k] = tmp;
                tmp = bound[i + 1];
                bound[i + 1] = bound[k + 1];
                bound[k + 1] = tmp;
                tmp = bound[i + 2];
                bound[i + 2] = bound[k + 2];
                bound[k + 2] = tmp;
                tmp = bound[i + 3];
                bound[i + 3] = bound[k + 3];
                bound[k + 3] = tmp;
            }
        }
    }
939753
protected void calculateRadius() {
        boundingCircleRadius = 0;
        
        for(int i=0;i<points.length;i+=2) {
            float temp = ((points[i] - center[0]) * (points[i] - center[0])) + 
                    ((points[i + 1] - center[1]) * (points[i + 1] - center[1]));
            boundingCircleRadius = (boundingCircleRadius > temp) ? boundingCircleRadius : temp;
        }
        boundingCircleRadius = (float)Math.sqrt(boundingCircleRadius);
    }
1312337
public double toPValue(double d, int n) {
    double b = d / 30 + 1. / (36 * n);
    double z = .5 * MathUtil.PISQUARE * MathUtil.PISQUARE * n * b;

    // Exponential approximation
    if(z < 1.1 || z > 8.5) {
      double e = FastMath.exp(0.3885037 - 1.164879 * z);
      return (e > 1) ? 1 : (e < 0) ? 0 : e;
    }
    // Tabular approximation
    for(int i = 0; i < 86; i++) {
      if(TABPOS[i] >= z) {
        // Exact table value
        if(TABPOS[i] == z) {
          return TABVAL[i];
        }
        // Linear interpolation
        double x1 = TABPOS[i], x0 = TABPOS[i - 1];
        double y1 = TABVAL[i], y0 = TABVAL[i - 1];
        return y0 + (y1 - y0) * (z - x0) / (x1 - x0);
      }
    }
    return -1;
  }