문제

What is this function doing? It states it is the normalized version of the dot product, which I presumed meant

func norm_dot(A,B) = dot(A,B) / ||B||^2

but

vec A(3,1) ; A.randu() ;
vec B(3,1) ; B.randu() ;

double dot1 = dot(A,B) /  arma::accu(arma::square(B)) ;

double dot2 = norm_dot(A,B) ;

dot1 != dot2

도움이 되었습니까?

해결책

The normalised dot product would be

dot(A,B)/(|A||B|)

Your expression only works for |A|=|B|

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top