Description Usage Arguments Details Value Notes Examples
gp_lagMatrix
returns a matrix of differences between two vectors.
1 | gp_lagMatrix(x, y)
|
x |
vector 1 |
y |
vector 2 (default to vector 1 if not specified) |
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]
.
N*M
array of absolute differences, result[i,j] = |x[i] - y[j]|
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 synchronous and evenly spaced (x[i] = y[i] = i *
delta + const
) then we have a circulant matrix; the j
th column
result[,j]
is the (j-1)
th cyclic permutation of the first
column. This matrix is symmetric, Toeplitz and circulant.
1 2 | result <- gp_lagMatrix(c(1,2,3), c(2,3,4,5,6))
print(result)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.