pearsonMatrix

These overloads allow for correlation and covariance matrices to be computed with the results being stored in a pre-allocated variable, ans. ans must be either a SciD matrix or a random-access range of ranges with assignable elements of a floating point type. It must have the same number of rows as the number of vectors in mat and must have at least enough columns in each row to support storing the lower triangle. If ans is a full rectangular matrix/range of ranges, only the lower triangle results will be stored.

Note: These functions can be used without SciD because they don't return SciD types.

  1. SymmetricMatrix!double pearsonMatrix(RoR mat, TaskPool pool = null)
  2. void pearsonMatrix(RoR mat, ref Ret ans, TaskPool pool = null)
    void
    pearsonMatrix
    (
    RoR
    Ret
    )
    (
    RoR mat
    ,
    ref Ret ans
    ,
    TaskPool pool = null
    )
    if (
    isInputRange!RoR &&
    isInputRange!(ElementType!RoR)
    &&
    is(ElementType!(ElementType!RoR) : double)
    &&
    !isInfinite!RoR
    &&
    (
    is(typeof(ans[0, 0] = 2.0)) ||
    is(typeof(ans[0][0] = 2.0))
    )
    )
  3. void spearmanMatrix(RoR mat, ref Ret ans, TaskPool pool = null)
  4. void kendallMatrix(RoR mat, ref Ret ans, TaskPool pool = null)
  5. void covarianceMatrix(RoR mat, ref Ret ans, TaskPool pool = null)

Examples

auto pearsonRoR = [[0.0], [0.0, 0.0], [0.0, 0.0, 0.0]];
pearsonMatrix(input, pearsonRoR);
assert(approxEqual(pearsonRoR[1][1], 1));

Meta