R/getCosine.R

Defines functions getCosine

Documented in getCosine

getCosine <-
function(v1,v2){
	# Find the cosine value of angle of vectors v1 and v2
	if(sum(v1^2)*sum(v2^2)==0)return(0)
	return(sum(v1*v2)/sqrt(sum(v1^2)*sum(v2^2)))
    
}

Try the CHAT package in your browser

Any scripts or data that you put into this service are public.

CHAT documentation built on May 29, 2017, 10:32 p.m.