cosine_sim_func: Calculate the pairwise similarity between rows of numeric...

Description Usage Arguments Value Examples

View source: R/math-funcs.R

Description

Calculate the pairwise similarity between rows of numeric matrices

Usage

1

Arguments

a

Input matrix.

b

Input matrix. Optional. If 'b' is NULL, use 'a', i.e. similarity between the rows of 'a' would be computed.

Value

Matrix of the similarity between the rows of a and the rows of b.

Examples

1
2
3
4
m <- matrix(1:8, ncol = 4) # a 2x4 matrix
n <- matrix(9:16, ncol = 4) # a 2x4 matrix
cosine_sim_func(m)
cosine_sim_func(m, n) # a 4x4 similarity matrix

trang1618/tdapseudotime documentation built on Feb. 9, 2021, 6:14 p.m.