Return the number of doubling collisions required.

    Calculates the number of doubling collisions required to produce
    a floc of diameter DiamTarget.
180881
def num_coll_reqd(DIM_FRACTAL, material, DiamTarget):
    
    return DIM_FRACTAL * np.log2(DiamTarget/material.Diameter)
389806
public double numWithSideEffects()
  {
    int node = nextNode();

    return (node != DTM.NULL) ? getNumberFromNode(node) : Double.NaN;
  }
372724
private static List<Set<Integer>> enlargeAggregates(
                List<Set<Integer>> C, List<Set<Integer>> N, boolean[] R) {

            // Contains the aggregates each node is coupled to
            List<List<Integer>> belong = new ArrayList<List<Integer>>(R.length);
            for (int i = 0; i < R.length; ++i)
                belong.add(new ArrayList<Integer>());

            // Find which aggregate each node is coupled to. This is used for
            // the intersection between Ni and Ck
            for (int k = 0; k < C.size(); ++k)
                for (int j : C.get(k))
                    belong.get(j).add(k);

            // Number of nodes in the intersection between each C and Ni
            int[] intersect = new int[C.size()];

            for (int i = 0; i < R.length; ++i) {

                // Skip non-free nodes
                if (!R[i])
                    continue;

                // Find the number of nodes intersecting Ni and every C, and
                // keep a track on the largest overlap
                Arrays.fill(intersect, 0);
                int largest = 0, maxValue = 0;
                for (int j : N.get(i))

                    // The k-index is to an aggregate coupled to node j
                    for (int k : belong.get(j)) {
                        intersect[k]++;
                        if (intersect[k] > maxValue) {
                            largest = k;
                            maxValue = intersect[largest];
                        }
                    }

                // Add the node to the proper C-set, and mark it as used
                // Also, check if the node actually does couple to a set
                if (maxValue > 0) {
                    R[i] = false;
                    C.get(largest).add(i);
                }
            }

            return C;
        }
969452
def multiplicity(self):
        
        sga = SpacegroupAnalyzer(self.bulk_structure)
        periodic_struc = sga.get_symmetrized_structure()
        poss_deflist = sorted(
            periodic_struc.get_sites_in_sphere(self.site.coords, 2, include_index=True), key=lambda x: x[1])
        defindex = poss_deflist[0][2]

        equivalent_sites = periodic_struc.find_equivalent_sites(self.bulk_structure[defindex])
        return len(equivalent_sites)
582006
@Override
	public double getAverage() {
		if(isDeterministic()) {
			return valueIfNonStochastic;
		}
		if(size() == 0) {
			return Double.NaN;
		}

		return getRealizationsStream().sum()/size();
	}
312585
def ent_tank_a(self):
        
        # first guess planview area
        a_new = 1 * u.m**2
        a_ratio = 2  # set to >1+tolerance to start while loop
        tolerance = 0.01
        a_floc_pv = (
            self.floc.vol /
            (self.floc.downstream_H + (self.floc.HL / 2))
        )
        while a_ratio > (1 + tolerance):
            a_et_pv = a_new
            a_etf_pv = a_et_pv + a_floc_pv
            w_tot = a_etf_pv / self.floc.max_L
            w_chan = w_tot / self.floc.channel_n

            a_new = self.floc.max_L * w_chan
            a_ratio = a_new / a_et_pv
        return a_new
602109
public double calcAvgSeek() {
        int count = 0;

        for (int i = 0, len = mSymbols.length; i < len; ++i) {
            if (mSymbols[i] != null) {
                ++count;
            }
        }

        for (int i = 0, len = mBuckets.length; i < len; ++i) {
            Bucket b = mBuckets[i];
            int cost = 2;
            while (b != null) {
                count += cost;
                ++cost;
                b = b.getNext();
            }
        }

        return ((double) count) / ((double) mSize);
    }
527016
private void doubleCapacity() {
        assert head == tail;
        int p = head;
        int n = elements.length;
        int r = n - p; // number of elements to the right of p
        int newCapacity = n << 1;
        if (newCapacity < 0)
            throw new IllegalStateException("Sorry, deque too big");
        Object[] a = new Object[newCapacity];
        System.arraycopy(elements, p, a, 0, r);
        System.arraycopy(elements, 0, a, r, p);
        elements = a;
        head = 0;
        tail = n;
    }
144695
public int totalSize() {
        int size = 0;
        for (F first: keySet()) {
            size += getCounter(first).size();
        }

        return size;
    }
597716
def n(self):
        '''
        
        '''
        try:
            n_mat = self.slabs['0'].n
            for s in range(1, self.slab_count):
                n_mat = np.vstack((self.slabs[str(s)].n, n_mat))
        except KeyError:
            n_mat = None
        return n_mat
538332
def getWorkingCollisionBoundsInfo(self):
        

        fn = self.function_table.getWorkingCollisionBoundsInfo
        pQuadsBuffer = HmdQuad_t()
        punQuadsCount = c_uint32()
        result = fn(byref(pQuadsBuffer), byref(punQuadsCount))
        return result, pQuadsBuffer, punQuadsCount.value
903472
function calculateCollatzConjecture(number) {
  if (!(number in cache)) {
    if (number % 2 === 0) cache[number] = number >> 1;
    else cache[number] = number * 3 + 1;
  }

  return cache[number];
}
868586
public int getInstanceSlot(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException {
        if (!isValid()) {
            throw new DataflowAnalysisException("Accessing invalid frame at " + ins);
        }
        int numConsumed = ins.consumeStack(cpg);
        if (numConsumed == Const.UNPREDICTABLE) {
            throw new DataflowAnalysisException("Unpredictable stack consumption in " + ins);
        }
        if (numConsumed > getStackDepth()) {
            throw new DataflowAnalysisException("Stack underflow " + ins);
        }
        return getNumSlots() - numConsumed;
    }
139639
public synchronized double getAverageMS()
    {
        double result = 0.0;

        for( Double d : m_times.m_values )
        {
            result += d;
        }

        return result / m_times.size();
    }
288022
def get_stride(self):
        
        fftlength = float(self.args.secpfft)
        overlap = fftlength * self.args.overlap
        stride = fftlength - overlap
        nfft = self.duration / stride  # number of FFTs
        ffps = int(nfft / (self.width * 0.8))  # FFTs per second
        if ffps > 3:
            return max(2 * fftlength, ffps * stride + fftlength - 1)
        return None
1159282
@Override
	public double calculatePhase1InitialFeasiblePoint(double[] originalNotFeasiblePoint, double tolerance){
		//DoubleMatrix1D X0NF = F1.make(originalNotFeasiblePoint);
		DoubleMatrix1D fiX0NF = F1.make(fi.length);
		for(int i=0; i<fi.length; i++){
			fiX0NF.set(i, this.fi[i].value(originalNotFeasiblePoint));
		}
		
		//lucky strike?
		int maxIneqIndex = Utils.getMaxIndex(fiX0NF);
		if(fiX0NF.get(maxIneqIndex) < 0){
			//the given notFeasible starting point is in fact already feasible
			return -1;
		}
		
		double s = Math.pow(tolerance,-0.5);
		for(int i=0; i<fiX0NF.size(); i++){
			s = Math.max(s, fiX0NF.get(i)*Math.pow(tolerance,-0.5));
		}
		
		return s;
	}
1039091
private static int getMonomerCountFromMonomerNotation(MonomerNotation monomerNotation) {
    int multiply;
    try {
      multiply = Integer.parseInt(monomerNotation.getCount());
      if (multiply < 1) {
        multiply = 1;
      }
    } catch (NumberFormatException e) {
      multiply = 1;
    }

    if (monomerNotation instanceof MonomerNotationGroup) {
      return 1 * multiply;
    }
    if (monomerNotation instanceof MonomerNotationList) {
      int count = 0;
      for (MonomerNotation unit : ((MonomerNotationList) monomerNotation).getListofMonomerUnits()) {
        count += getMonomerCountFromMonomerNotation(unit);
      }
      return count * multiply;
    }

    if (monomerNotation instanceof MonomerNotationUnitRNA) {
      int count = 0;
      for (MonomerNotationUnit unit : ((MonomerNotationUnitRNA) monomerNotation).getContents()) {
        count += getMonomerCountFromMonomerNotation(unit);
      }
      return count * multiply;
    }
    return 1 * multiply;
  }