The version registered with dist is custom (loop = FALSE in
pr_DB). The custom function handles multi-threaded parallelization
directly (with RcppParallel). It uses all
available threads by default (see
RcppParallel::defaultNumThreads()), but this can
be changed by the user with
RcppParallel::setThreadOptions().
An exception to the above is when it is called within a foreach
parallel loop made by dtwclust. If the parallel workers do not have the number of
threads explicitly specified, this function will default to 1 thread per worker. See the
parallelization vignette for more information (browseVignettes("dtwclust")).
It also includes symmetric optimizations to calculate only half a distance matrix when
appropriate---only one list of series should be provided in x. If you want to avoid this
optimization, call dist by giving the same list of series in both x
and y.
In some situations, e.g. for relatively small distance matrices, the overhead introduced by the
logic that computes only half the distance matrix can be bigger than just calculating the whole
matrix.