private void computeJacobian(double[][] input, int[] block)
{
double[] derivatives = new double[numberOfParameters];
// for each input sample
foreach (int i in block)
{
// TODO: transpose the Jacobian to remove copying
Gradient(solution, input[i], derivatives);
// copy the gradient vector into the Jacobian
for (int j = 0; j < derivatives.Length; j++)
jacobian[j][i] = derivatives[j];
}
}