function getP(matrix, i, a, b, l) {
  if (b === l) {
    return getCenteredElement(matrix, 1, i, 1) *
        getCenteredElement(matrix, l - 1, a, l - 1) -
        getCenteredElement(matrix, 1, i, -1) *
        getCenteredElement(matrix, l - 1, a, -l + 1);
  } else if (b === -l) {
    return getCenteredElement(matrix, 1, i, 1) *
        getCenteredElement(matrix, l - 1, a, -l + 1) +
        getCenteredElement(matrix, 1, i, -1) *
        getCenteredElement(matrix, l - 1, a, l - 1);
  } else {
    return getCenteredElement(matrix, 1, i, 0) *
        getCenteredElement(matrix, l - 1, a, b);
  }
}
Helper function defined in [2] that is used by the functions U, V, W.
This should not be called on its own, as U, V, and W (and their coefficients)
select the appropriate matrix elements to access arguments |a| and |b|.
@param {Number[]} matrix - N matrices of gainNodes, each with (2n+1) x (2n+1)
elements, where n=1,2,...,N.
@param {Number} i
@param {Number} a
@param {Number} b
@param {Number} l
@return {Number}