What is R's crossproduct function? -
i feel stupid asking, intent of r's crossprod function respect vector inputs? wanted calculate cross-product of 2 vectors in euclidean space , mistakenly tried using crossprod .
1 definition of vector cross-product n = |a|*|b|*sin(theta) theta angle between 2 vectors. (the direction of n perpendicular a-b plane). way calculate n = ax*by - ay*bx .
base::crossprod not calculation, , in fact produces vector dot-product of 2 inputs sum(ax*bx, ay*by).
so, can write own vectorxprod(a,b) function, can't figure out crossprod doing in general.
according function in r: crossprod (x,y) = t(x)%*% y faster implementation expression itself. function of 2 matrices, , if have 2 vectors corresponds dot product.
Comments
Post a Comment