public NNCalc calcJacobi(double[] nnInp) {

        final NNCalc res = NNresjacob;

        for (int i = 0; i < nn_in; i++) {
            act[0][i] = (nnInp[i] - inmin[i]) / (inmax[i] - inmin[i]);
        }

        for (int pl = 0; pl < nplanes - 1; pl++) {
            final double[] act_pl_1 = act[pl + 1];
            final double[] help_pl = help[pl];
            final double[][] wgt_pl = wgt[pl];
            final double[] bias_pl = bias[pl];
            final double[] act_pl = act[pl];

            for (int i = 0; i < size[pl + 1]; i++) {
                act_pl_1[i] = activation(bias_pl[i] + scp(wgt_pl[i], act_pl));
                help_pl[i] = act_pl_1[i] * (1.0 - act_pl_1[i]);
            }

            final double[][] dActDX_pl = dActDX[pl];
            final double[][] dActDX_pl1 = dActDX[pl + 1];

            for (int i = 0; i < size[pl + 1]; i++) {
                for (int j = 0; j < nn_in; j++) {
                    double sum = 0.0;
                    final double help_pl_i = help_pl[i];
                    final double[] wgt_pl_i = wgt_pl[i];

                    for (int k = 0; k < size[pl]; k++) {
                        sum += help_pl_i * wgt_pl_i[k] * dActDX_pl[k][j];
                    }

                    dActDX_pl1[i][j] = sum;
                }
            }
        }


        final double[] act_nplanes_1 = act[nplanes - 1];
        final double[][] dActDX_nplanes_1 = dActDX[nplanes - 1];

        final double[][] jacobiMatrix = res.getJacobiMatrix();
        final double[] nnOutput = res.getNnOutput();
        for (int i = 0; i < nn_out; i++) {
            final double diff = outmax[i] - outmin[i];
            nnOutput[i] = act_nplanes_1[i] * diff + outmin[i];
            final double[] res_jacobiMatrix_i = jacobiMatrix[i];
            final double[] dActDX_nplanes_1_i = dActDX_nplanes_1[i];
            for (int k = 0; k < nn_in; k++) {
                res_jacobiMatrix_i[k] = dActDX_nplanes_1_i[k] * diff;
            }
        }
        return res;


    }