Step.

@param state the state
@param ch1 the ch 1
@param ch2 the ch 2
@return the double[][]
7124
private double[][] _step(double[][] state, char ch1, char ch2) {
    double cost;
    _shift(state);
    state[2][0] = state[1][0] + deletionDistance;
    for (int i = 0; i < morseBase.length(); i++) {
      cost = (morseBase.charAt(i) == ch1) ? 0 : replaceDistance;
      state[2][i + 1] = Math.min(state[2][i] + insertionDistance,
          state[1][i] + cost);
      state[2][i + 1] = Math.min(state[2][i + 1],
          state[1][i + 1] + deletionDistance);
      if (i > 0 && ch2 != 0x00 && (morseBase.charAt(i - 1) == ch1)
          && (morseBase.charAt(i) == ch2)) {
        state[2][i + 1] = Math.min(state[2][i + 1],
            state[0][i - 1] + transpositionDistance);
      }
    }
    return state;
  }
109984
function cloneSHA3State(state) {
		var clone = [], i;
		for (i = 0; i < 5; i += 1)
		{
			clone[i] = state[i].slice();
		}

		return clone;
	}
792308
private double[][] _start() {
    double[][] startState = new double[2][];
    startState[0] = new double[initialState.length];
    startState[1] = Arrays.copyOf(initialState, initialState.length);
    return startState;
  }
956698
private void _shift(double[][] state) {
    double[] tmpState = state[0];
    state[0] = state[1];
    state[1] = state[2];
    state[2] = tmpState;
  }
846519
public ListStepsRequest withStepStates(StepState... stepStates) {
        com.amazonaws.internal.SdkInternalList<String> stepStatesCopy = new com.amazonaws.internal.SdkInternalList<String>(stepStates.length);
        for (StepState value : stepStates) {
            stepStatesCopy.add(value.toString());
        }
        if (getStepStates() == null) {
            setStepStates(stepStatesCopy);
        } else {
            getStepStates().addAll(stepStatesCopy);
        }
        return this;
    }
1146706
public function getStateCandidates(int $state): array
    {
        $candidates = [];

        foreach ($this->candidates as $candidateId => $candidate) {
            if ($candidate->getState() == $state) {
                $candidates[$candidateId] = $candidate;
            }
        }

        return $candidates;
    }
47221
public static double[][] timesTranspose(final double[] v1, final double[] v2) {
    final double[][] re = new double[v1.length][v2.length];
    for(int j = 0; j < v2.length; j++) {
      for(int i = 0; i < v1.length; i++) {
        re[i][j] = v1[i] * v2[j];
      }
    }
    return re;
  }
904772
public static double[] doublesFrom(InputStream is) {
        ArrayList<Double> doubles = new ArrayList<Double>();
        for (String line : new LineReader(is)) {
            if (line.length() > 0 && !line.startsWith("#"))
                doubles.add(Double.parseDouble(line));
        }
        // copy it, because we can't cast from Double to double...
        double[] ret = new double[doubles.size()];
        for (int i = 0; i < doubles.size(); i++) {
            ret[i] = doubles.get(i);
        }
        return ret;
    }
979265
@Nonnull
    public List<S> bfsStates() {
        List<S> stateList = new ArrayList<>();
        Set<S> visited = new HashSet<>();

        int ptr = 0;
        stateList.add(root);
        visited.add(root);
        int numStates = 1;

        while (ptr < numStates) {
            S curr = stateList.get(ptr++);
            for (int i = 0; i < alphabetSize; i++) {
                S succ = curr.getSuccessor(i);
                if (succ != null && visited.add(succ)) {
                    stateList.add(succ);
                    numStates++;
                }
            }
        }

        return stateList;
    }
1241318
function(state1, state2) {

		// if state1 is undefined, return state2 + isEqual=false and velocity=0 as delta
		if(!state1 || !state2)
			return angular.extend(
				{isEqual: false, velocityX: 0, velocityY: 0},
				state2
			);

		// calculate delta of state1 and state2
		var delta= {
			posX: state2.posX - state1.posX,
			posY: state2.posY - state1.posY,
			width: state2.width - state1.width,
			height: state2.height - state1.height,
			maxWidth: state2.maxWidth - state1.maxWidth,
			maxHeight: state2.maxHeight - state1.maxHeight,
		};

		// add velocity information
		if(state2.width > 0)
			delta.velocityX= delta.posX / state2.width;
		if(state2.height > 0)
			delta.velocityY= delta.posY / state2.height;

		// if any property is not 0, the delta is not zero
		delta.isEqual= !(
			delta.posX !== 0 ||
			delta.posY !== 0 ||
			delta.width !== 0 ||
			delta.height !== 0 ||
			delta.maxWidth !== 0 ||
			delta.maxHeight !== 0
		);

		return delta;
	}
1128682
public DoublePoint Multiply(DoublePoint point1, DoublePoint point2) {
        DoublePoint result = new DoublePoint(point1);
        result.Multiply(point2);
        return result;
    }
628349
function (input, stateMachine) {
      if (!input) { return []; }
      if (stateMachine === undefined) { stateMachine = 'ce'; }
      var state = '0';

      //
      // String buffers for parsing:
      //
      // buffer.a == amount
      // buffer.o == element
      // buffer.b == left-side superscript
      // buffer.p == left-side subscript
      // buffer.q == right-side subscript
      // buffer.d == right-side superscript
      //
      // buffer.r == arrow
      // buffer.rdt == arrow, script above, type
      // buffer.rd == arrow, script above, content
      // buffer.rqt == arrow, script below, type
      // buffer.rq == arrow, script below, content
      //
      // buffer.text_
      // buffer.rm
      // etc.
      //
      // buffer.parenthesisLevel == int, starting at 0
      // buffer.sb == bool, space before
      // buffer.beginsWithBond == bool
      //
      // These letters are also used as state names.
      //
      // Other states:
      // 0 == begin of main part (arrow/operator unlikely)
      // 1 == next entity
      // 2 == next entity (arrow/operator unlikely)
      // 3 == next atom
      // c == macro
      //
      /** @type {Buffer} */
      var buffer = {};
      buffer['parenthesisLevel'] = 0;

      input = input.replace(/\n/g, " ");
      input = input.replace(/[\u2212\u2013\u2014\u2010]/g, "-");
      input = input.replace(/[\u2026]/g, "...");

      //
      // Looks through mhchemParser.transitions, to execute a matching action
      // (recursive)
      //
      var lastInput;
      var watchdog = 10;
      /** @type {ParserOutput[]} */
      var output = [];
      while (true) {
        if (lastInput !== input) {
          watchdog = 10;
          lastInput = input;
        } else {
          watchdog--;
        }
        //
        // Find actions in transition table
        //
        var machine = mhchemParser.stateMachines[stateMachine];
        var t = machine.transitions[state] || machine.transitions['*'];
        iterateTransitions:
        for (var i=0; i<t.length; i++) {
          var matches = mhchemParser.patterns.match_(t[i].pattern, input);
          if (matches) {
            //
            // Execute actions
            //
            var task = t[i].task;
            for (var iA=0; iA<task.action_.length; iA++) {
              var o;
              //
              // Find and execute action
              //
              if (machine.actions[task.action_[iA].type_]) {
                o = machine.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
              } else if (mhchemParser.actions[task.action_[iA].type_]) {
                o = mhchemParser.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
              } else {
                throw ["MhchemBugA", "mhchem bug A. Please report. (" + task.action_[iA].type_ + ")"];  // Trying to use non-existing action
              }
              //
              // Add output
              //
              mhchemParser.concatArray(output, o);
            }
            //
            // Set next state,
            // Shorten input,
            // Continue with next character
            //   (= apply only one transition per position)
            //
            state = task.nextState || state;
            if (input.length > 0) {
              if (!task.revisit) {
                input = matches.remainder;
              }
              if (!task.toContinue) {
                break iterateTransitions;
              }
            } else {
              return output;
            }
          }
        }
        //
        // Prevent infinite loop
        //
        if (watchdog <= 0) {
          throw ["MhchemBugU", "mhchem bug U. Please report."];  // Unexpected character
        }
      }
    }
625791
public List<List<DoubleSolution>> generatePairsFromSolutionList(List<DoubleSolution> solutionList) {
    List<List<DoubleSolution>> subset = new ArrayList<>() ;
    for (int i = 0; i < solutionList.size(); i++) {
      DoubleSolution solution1 = solutionList.get(i);
      for (int j = i + 1; j < solutionList.size(); j++) {
        DoubleSolution solution2 = solutionList.get(j);

        if (!marked.getAttribute(solution1) ||
            !marked.getAttribute(solution2)) {
          List<DoubleSolution> pair = new ArrayList<>(2);
          pair.add(solution1);
          pair.add(solution2);
          subset.add(pair);

          marked.setAttribute(solutionList.get(i), true);
          marked.setAttribute(solutionList.get(j), true);
        }
      }
    }

    return subset ;
  }
996740
public static double dot(@javax.annotation.Nonnull final List<double[]> a, @javax.annotation.Nonnull final List<double[]> b) {
    return com.simiacryptus.util.ArrayUtil.sum(com.simiacryptus.util.ArrayUtil.multiply(a, b));
  }
647906
public final void mul(Quaternion q1, Quaternion q2) {
		if (this != q1 && this != q2) {
			this.w = q1.w*q2.w - q1.x*q2.x - q1.y*q2.y - q1.z*q2.z;
			this.x = q1.w*q2.x + q2.w*q1.x + q1.y*q2.z - q1.z*q2.y;
			this.y = q1.w*q2.y + q2.w*q1.y - q1.x*q2.z + q1.z*q2.x;
			this.z = q1.w*q2.z + q2.w*q1.z + q1.x*q2.y - q1.y*q2.x;
		}
		else {
			double	x1, y1, w1;

			w1 = q1.w*q2.w - q1.x*q2.x - q1.y*q2.y - q1.z*q2.z;
			x1 = q1.w*q2.x + q2.w*q1.x + q1.y*q2.z - q1.z*q2.y;
			y1 = q1.w*q2.y + q2.w*q1.y - q1.x*q2.z + q1.z*q2.x;
			this.z = q1.w*q2.z + q2.w*q1.z + q1.x*q2.y - q1.y*q2.x;
			this.w = w1;
			this.x = x1;
			this.y = y1;
		}
	}
543462
static double[] incremental(final double[] values) {
		final DoubleAdder adder = new DoubleAdder(values[0]);
		for (int i = 1; i < values.length; ++i) {
			values[i] = adder.add(values[i]).doubleValue();
		}
		return values;
	}
803838
public java.util.List<StepExecution> getStepExecutions() {
        if (stepExecutions == null) {
            stepExecutions = new com.amazonaws.internal.SdkInternalList<StepExecution>();
        }
        return stepExecutions;
    }