private QuadraticSolver buildIterationSolver(final boolean addSmallDiagonal) {

    MatrixStore<Double> tmpQ = this.getQ();
    final MatrixStore<Double> tmpC = this.getC();

    if (addSmallDiagonal) {

      final PhysicalStore<Double> tmpCopyQ = tmpQ.copy();

      final double tmpLargest = tmpCopyQ.aggregateAll(Aggregator.LARGEST);
      final double tmpRelativelySmall = MACHINE_DOUBLE_ERROR * tmpLargest;
      final double tmpPracticalLimit = MACHINE_DOUBLE_ERROR + IS_ZERO;
      final double tmpSmallToAdd = Math.max(tmpRelativelySmall, tmpPracticalLimit);

      final UnaryFunction<Double> tmpFunc = ADD.second(tmpSmallToAdd);

      tmpCopyQ.modifyDiagonal(0, 0, tmpFunc);
      tmpQ = tmpCopyQ;
    }

    if (this.hasEqualityConstraints()) {

      final MatrixStore<Double> tmpAE = this.getAE();
      final MatrixStore<Double> tmpBE = this.getBE();

      final int tmpZeroSize = tmpAE.getRowDim();

      final MatrixStore<Double> tmpUpperLeftAE = tmpQ;
      final MatrixStore<Double> tmpUpperRightAE = tmpAE.builder().transpose().build();
      final MatrixStore<Double> tmpLowerLefAE = tmpAE;
      final MatrixStore<Double> tmpLowerRightAE = ZeroStore.makePrimitive(tmpZeroSize, tmpZeroSize);

      final MatrixStore<Double> tmpSubAE =
          new AboveBelowStore<Double>(
              new LeftRightStore<Double>(tmpUpperLeftAE, tmpUpperRightAE),
              new LeftRightStore<Double>(tmpLowerLefAE, tmpLowerRightAE));

      final MatrixStore<Double> tmpUpperBE = tmpC;
      final MatrixStore<Double> tmpLowerBE = tmpBE;

      final MatrixStore<Double> tmpSubBE = new AboveBelowStore<Double>(tmpUpperBE, tmpLowerBE);

      return new Builder().equalities(tmpSubAE, tmpSubBE).build(options);

    } else {

      return new Builder().equalities(tmpQ, tmpC).build(options);
    }
  }
 public TextCommandServiceImpl(Node node) {
   this.node = node;
   this.hazelcast = node.factory;
   this.logger = node.getLogger(this.getClass().getName());
   this.parallelExecutor = this.node.executorManager.newParallelExecutor(40);
   textCommandProcessors[GET.getValue()] = new GetCommandProcessor(this, true);
   textCommandProcessors[PARTIAL_GET.getValue()] = new GetCommandProcessor(this, false);
   textCommandProcessors[SET.getValue()] = new SetCommandProcessor(this);
   textCommandProcessors[ADD.getValue()] = new SetCommandProcessor(this);
   textCommandProcessors[REPLACE.getValue()] = new SetCommandProcessor(this);
   textCommandProcessors[GET_END.getValue()] = new NoOpCommandProcessor(this);
   textCommandProcessors[DELETE.getValue()] = new DeleteCommandProcessor(this);
   textCommandProcessors[QUIT.getValue()] = new SimpleCommandProcessor(this);
   textCommandProcessors[STATS.getValue()] = new StatsCommandProcessor(this);
   textCommandProcessors[UNKNOWN.getValue()] = new ErrorCommandProcessor(this);
   textCommandProcessors[ERROR_CLIENT.getValue()] = new ErrorCommandProcessor(this);
   textCommandProcessors[ERROR_SERVER.getValue()] = new ErrorCommandProcessor(this);
   textCommandProcessors[HTTP_GET.getValue()] = new HttpGetCommandProcessor(this);
   textCommandProcessors[HTTP_POST.getValue()] = new HttpPostCommandProcessor(this);
   textCommandProcessors[HTTP_PUT.getValue()] = new HttpPostCommandProcessor(this);
   textCommandProcessors[HTTP_DELETE.getValue()] = new HttpDeleteCommandProcessor(this);
   textCommandProcessors[NO_OP.getValue()] = new NoOpCommandProcessor(this);
 }