; docformat = 'rst' ;+ ; Takes the dot product of the two input vectors a and b. ; ; :Examples: ; product = dotp(vector_a, vector_b) ;- ;+ ; :Params: ; a : in, required, type=vector of int or vector of double ; Input vector that will be used to calculate the dot product. ; b : in, required, type=vector of int or vector of double ; Input vector that will be used to calculate the dot product. ; ; :Returns: ; Returns the dot product of the two input vectors. ;- function dotp,a,b if (n_elements(a) eq 0 or n_elements(b) eq 0) then begin doc_library, 'dotp' return, -1 endif resolve_grid,a,x=ax,y=ay,z=az,w=aw resolve_grid,b,x=bx,y=by,z=bz,w=bw result=ax*bx result+=ay*by result+=az*bz if n_elements(aw) gt 0 then result+=aw*bw return,result end