matrix_tau: Compute a matrix of differences given two vectors.

Description Usage Arguments Details Value Notes Examples

View source: R/dcf_functions.R

Description

matrix_tau returns a matrix of differences between two vectors.

Usage

1
matrix_tau(x, y)

Arguments

x

vector 1

y

vector 2 (default to vector 1 if not specified)

Details

Given two vectors - x (length M) and y (length N) - as input, return the N*M matrix of differences result[i,j] = x[i] - y[j].

Value

N*M array of differences, result[i,j] = x[i] - y[j]

Notes

Note that in the special case that x=y we have a square symmetric matrix: result[i,j] = result[j,i]. In the even more special case that the two vectors are evenly spaced (x[i] = y[i] = i * delta + const) then we have a circulant matrix; the jth column result[,j] is the (j-1)th cyclic permutation of the first column. This matrix is symmetric, Toeplitz and circulant.

Examples

1
2
result <- matrix_tau(c(1,2,3), c(2,3,4,5,6))
print(result)

svdataman/sour documentation built on April 6, 2018, 11:13 a.m.