function _corr (A, B) {
    const correlations = []
    if (Array.isArray(A[0]) && Array.isArray(B[0])) {
      if (A.length !== B.length) {
        throw new SyntaxError('Dimension mismatch. Array A and B must have the same length.')
      }
      for (let i = 0; i < A.length; i++) {
        if (A[i].length !== B[i].length) {
          throw new SyntaxError('Dimension mismatch. Array A and B must have the same number of elements.')
        }
        correlations.push(correlation(A[i], B[i]))
      }
      return correlations
    } else {
      if (A.length !== B.length) {
        throw new SyntaxError('Dimension mismatch. Array A and B must have the same number of elements.')
      }
      return correlation(A, B)
    }
  }
Calculate the correlation coefficient between two arrays or matrices.
@param {Array | Matrix} A
@param {Array | Matrix} B
@return {*} correlation coefficient
@private