computeJacobian method

  1. @override
Matrix computeJacobian(
  1. Vector v
)
override

Computes the Jacobian matrix using the content of v as parameters

Implementation

@override
Matrix computeJacobian(Vector v) {
  Matrix first = parameters.mapRows((row) => (v - row));
  Vector divisor = (first.mapRows((row) => row.pow(2)))
      .reduceColumns((combine, vector) => combine + vector)
      .sqrt();

  List<Vector> tmpSecond = [];

  for (int i = 0; i < v.length; i++) {
    tmpSecond.add(divisor);
  }

  Matrix second = Matrix.fromColumns(tmpSecond).pow(-1);
  return first.multiply(second);
}