cachePermute: Permutation by Caching Distances

View source: R/auxiliary.R

cachePermuteR Documentation

Permutation by Caching Distances

Description

What do you do when you have to compute pairwise distances many times, and those damn distances take a long time to compute? Answer: You cache the distances and permute the underlying sample labels!

Usage

cachePermute(dists, forward, reverse)

Arguments

dists

{N \choose 2} by B matrix, with each column containing the distances (ex: Hamming, l_p^p) for the block

forward

N \times N matrix mapping the pairs of sample labels to index of the {N \choose 2}-length vector

reverse

{N \choose 2}\times 2 matrix mapping the index to pairs of sample labels

Details

This function permutes the distances (Hamming, l_p^p, etc.) within blocks. Permutations respect the fact that we are actually permuting the underlying labels. Arguments forward and reverse should be precomputed using buildForward and buildReverse.

Dependencies: buildForward, buildReverse

Value

A matrix with same dimensions as dists containing the block-permuted pairwise distances


flintyR documentation built on March 31, 2023, 8:19 p.m.