Returns the sum of the object transformation cost for each class in the source
argument list.
@param srcArgs The source arguments
@param destArgs The destination arguments
@return The total transformation cost
350278
private static float getTotalTransformationCost(Class<?>[] srcArgs, Class<?>[] destArgs) {

        float totalCost = 0.0f;
        for (int i = 0; i < srcArgs.length; i++) {
            Class<?> srcClass, destClass;
            srcClass = srcArgs[i];
            destClass = destArgs[i];
            totalCost += getObjectTransformationCost(srcClass, destClass);
        }

        return totalCost;
    }
1090882
public org.tensorflow.framework.CostGraphDef getCostGraph() {
    return costGraph_ == null ? org.tensorflow.framework.CostGraphDef.getDefaultInstance() : costGraph_;
  }
1357765
protected double[] aggregateInternal(double[][] descriptors) {
		double[] vlad = new double[numCentroids * descriptorLength];
		// when there are 0 local descriptors extracted
		if (descriptors.length == 0) {
			return vlad;
		}

		for (double[] descriptor : descriptors) {
			int nnIndex = computeNearestCentroid(descriptor);
			for (int i = 0; i < descriptorLength; i++) {
				vlad[nnIndex * descriptorLength + i] += descriptor[i] - codebook[nnIndex][i];
			}
		}
		return vlad;
	}
1169188
public int getStrategy(Object object) {
        for ( int i = 0, length = this.strategiesList.length; i < length; i++ ) {
            if ( strategiesList[i].accept( object ) ) {
                return i;
            }
        }
        throw new RuntimeException( "Unable to find PlaceholderResolverStrategy for class : " + object.getClass() + " object : " + object );
    }
1337588
public function getTransformer(?array $sourcesTypes, ?array $targetTypes, MapperConfigurationInterface $mapperConfiguration): ?TransformerInterface
    {
        foreach ($this->factories as $factory) {
            $transformer = $factory->getTransformer($sourcesTypes, $targetTypes, $mapperConfiguration);

            if ($transformer !== null) {
                return $transformer;
            }
        }

        return null;
    }
290987
public void computeMST(double[][] costs, UndirectedGraph graph) throws ContradictionException {
		g = graph;
		ma = propHK.getMandatoryArcsList();
		sortArcs(costs);
		treeCost = 0;
		cctRoot = n - 1;
		int tSize = addMandatoryArcs();
		connectMST(tSize);
	}
1072984
public function getTransformations() {
        if ($this->transformations === null) {
            $this->transformations = [];

            $transformations = $this->query->get('t', []);

            if (!is_array($transformations)) {
                throw new InvalidArgumentException('Transformations must be specifed as an array', 400);
            }

            foreach ($transformations as $transformation) {
                if (!is_string($transformation)) {
                    throw new InvalidArgumentException('Invalid transformation', 400);
                }

                // See if the transformation has any parameters
                $pos = strpos($transformation, ':');
                $urlParams = '';

                if ($pos === false) {
                    // No params exist
                    $name = $transformation;
                } else {
                    list($name, $urlParams) = explode(':', $transformation, 2);
                }

                // Initialize params for the transformation
                $params = [];

                // Loop through the parameter string and assign params to an array
                $offset = 0;
                $pattern = '#(\w+)=(?:(.+?),\w+=|(.+?$))#';
                while (preg_match($pattern, $urlParams, $matches, PREG_OFFSET_CAPTURE, $offset)) {
                    $offset = $matches[2][1];
                    $paramName = $matches[1][0];
                    $paramValue = isset($matches[3]) ? $matches[3][0] : $matches[2][0];
                    $params[$paramName] = $paramValue;
                }

                $this->transformations[] = [
                    'name'   => $name,
                    'params' => $params,
                ];
            }
        }

        return $this->transformations;
    }
1075870
public static int selectConstructorAndTransformArguments(Object[] arguments, int numberOfConstructors, Class which) throws Throwable {
        MetaClass metaClass = GroovySystem.getMetaClassRegistry().getMetaClass(which);
        try {
            return metaClass.selectConstructorAndTransformArguments(numberOfConstructors, arguments);
        } catch (GroovyRuntimeException gre) {
            throw unwrap(gre);
        }
    }
557277
public static TObjectIntMap<VM> getWeights(ReconfigurationProblem rp, List<CShareableResource> rcs) {
        Model mo = rp.getSourceModel();

        int[] capa = new int[rcs.size()];
        int[] cons = new int[rcs.size()];
        TObjectIntMap<VM> cost = new TObjectIntHashMap<>();
        for (Node n : mo.getMapping().getAllNodes()) {
            for (int i = 0; i < rcs.size(); i++) {
                capa[i] += rcs.get(i).virtRcUsage.get(rp.getNode(n)).getUB() * rcs.get(i).ratios.get(rp.getNode(n))/*.getLB()*/;
            }
        }

        for (VM v : mo.getMapping().getAllVMs()) {
            for (int i = 0; i < rcs.size(); i++) {
                cons[i] += rcs.get(i).getVMAllocation(rp.getVM(v));
            }
        }

        for (VM v : mo.getMapping().getAllVMs()) {
            double sum = 0;
            for (int i = 0; i < rcs.size(); i++) {
                double ratio = 0;
                if (cons[i] > 0) {
                    ratio = 1.0 * rcs.get(i).getVMAllocation(rp.getVM(v)) / capa[i];
                }
                sum += ratio;
            }
            cost.put(v, (int) (sum * 10000));
        }
        return cost;
    }
237174
public static void shallowCopyFieldState(final Object src, final Object dest) {
		if (src == null) {
			throw new IllegalArgumentException("Source for field copy cannot be null");
		}
		if (dest == null) {
			throw new IllegalArgumentException("Destination for field copy cannot be null");
		}
		if (!src.getClass().isAssignableFrom(dest.getClass())) {
			throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() +
					"] must be same or subclass as source class [" + src.getClass().getName() + "]");
		}
		doWithFields(src.getClass(), new FieldCallback() {
			@Override
			public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
				makeAccessible(field);
				Object srcValue = field.get(src);
				field.set(dest, srcValue);
			}
		}, COPYABLE_FIELDS);
	}
618330
public int getTotalTriples() throws Exception {
		int total = 0;
		for (HashMap<String, Integer> mappingStat : statistics.values()) {
			for (Integer triplesCount : mappingStat.values()) {
				int triples = triplesCount.intValue();
				if (triples == -1) {
					throw new Exception("An error was occurred in the counting process.");
				}
				total = total + triples;
			}
		}
		return total;
	}
187619
@Override
    public List<Metric> transform(QueryContext context, List<Metric> metrics) {
        SystemAssert.requireArgument(metrics != null, "Cannot transform null metrics.");
        
        if (metrics.isEmpty()) {
            return metrics;
        }
        
        MetricDistiller distiller = new MetricDistiller();
        distiller.distill(metrics);

        String newMetricName = distiller.getMetric() == null ? TransformFactory.DEFAULT_METRIC_NAME : distiller.getMetric();
        Metric newMetric = new Metric(getResultScopeName(), newMetricName);

        newMetric.setDisplayName(distiller.getDisplayName());
        newMetric.setUnits(distiller.getUnits());
        newMetric.setTags(distiller.getTags());
        newMetric.setDatapoints(_collate(metrics));

        return Arrays.asList(newMetric);
    }
971435
def morph_cost(self) -> Optional["Cost"]:
        
        # Fix for BARRACKSREACTOR which has tech alias [REACTOR] which has (0, 0) cost
        if self.tech_alias is None or self.tech_alias[0] in {UnitTypeId.TECHLAB, UnitTypeId.REACTOR}:
            return None
        # Morphing a HIVE would have HATCHERY and LAIR in the tech alias - now subtract HIVE cost from LAIR cost instead of from HATCHERY cost
        tech_alias_cost_minerals = max([self._game_data.units[tech_alias.value].cost.minerals for tech_alias in self.tech_alias])
        tech_alias_cost_vespene = max([self._game_data.units[tech_alias.value].cost.vespene for tech_alias in self.tech_alias])
        return Cost(
                self._proto.mineral_cost - tech_alias_cost_minerals,
                self._proto.vespene_cost - tech_alias_cost_vespene,
                self._proto.build_time
            )
578708
public com.google.api.ads.admanager.axis.v201805.CostType getCostType() {
        return costType;
    }
143485
@Override
    protected Double transformToValue(DBObject dbObject) {
        DBObject valueObject = (DBObject) dbObject.get("value");
        Number t = (Number) valueObject.get("total");

        return t.doubleValue();
    }
542227
public void computeMST(double[][] costs, UndirectedGraph graph) throws ContradictionException {
		g = graph;
		for (int i = 0; i < n; i++) {
			Tree.getNeighOf(i).clear();
		}
		this.costs = costs;
		heap.clear();
		inTree.clear();
		treeCost = 0;
		tSize = 0;
		prim();
	}
1270377
public double sum() {
        double sum = 0;
        TIntDoubleIterator iter = edges.iterator();
        while (iter.hasNext()) {
            iter.advance();
            sum += iter.value();
        }
        return sum;
    }