MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / makeSimplex

Method makeSimplex

ij/src/main/java/ij/measure/Minimizer.java:611–636  ·  view source on GitHub ↗

Initialise the simplex and evaluate it. Returns null on failure.

(double[] initialParams, double[] initialParamVariations, Random random)

Source from the content-addressed store, hash-verified

609
610 /** Initialise the simplex and evaluate it. Returns null on failure. */
611 private double[][] makeSimplex(double[] initialParams, double[] initialParamVariations, Random random) {
612 double[][] simp = new double[numVertices][numParams+1+numExtraArrayElements];
613 /* simpTable.put(Thread.currentThread(), simp); */
614
615 if (initialParams!=null) {
616 for (int i=0; i<numParams; i++)
617 if (Double.isNaN(initialParams[i]))
618 if (IJ.debugMode) IJ.log("Warning: Initial Parameter["+i+"] is NaN");
619 System.arraycopy(initialParams, 0, simp[0], 0, Math.min(initialParams.length, numParams));
620 }
621 evaluate(simp[0]);
622 if (Double.isNaN(value(simp[0]))) {
623 if (IJ.debugMode) showVertex(simp[0], "Warning: Initial Parameters yield NaN:");
624 findValidInitalParams(simp[0], initialParamVariations, random);
625 }
626 if (Double.isNaN(value(simp[0]))) {
627 if (IJ.debugMode) IJ.log("Error: Could not find initial parameters not yielding NaN:");
628 return null;
629 }
630 if (initializeSimplex(simp, initialParamVariations, random))
631 return simp;
632 else {
633 if (IJ.debugMode) showSimplex(simp, "Error: Could not make simplex vertices not yielding NaN");
634 return null;
635 }
636 }
637
638 /** Whether the distance between the best and any other simplex vertex
639 * is less than the resolution of the parameters */

Callers 1

minimizeOnceMethod · 0.95

Calls 9

logMethod · 0.95
evaluateMethod · 0.95
valueMethod · 0.95
showVertexMethod · 0.95
findValidInitalParamsMethod · 0.95
initializeSimplexMethod · 0.95
showSimplexMethod · 0.95
arraycopyMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected