; docformat = 'rst' ;+ ;Component magnitude of vector u in the direction of vector b. ; ; :Examples: ; component_magnitude = comp(vector_u, vector_b) ;- ;+ ; :Params: ; u : in, required, type=vector of int or vector of double ; Input vector to compute the component magnitude from. ; b : in, required, type=vector of int or vector of double ; Input vector that gives the direction for the component ; magnitude. ; ; :Returns: ; Returns the component magnitude of vector u in the direction ; of vector b. ;- function comp,u,b if (n_elements(u) eq 0 or n_elements(b) eq 0) then begin doc_library, 'comp' return, -1 endif return,dotp(u,b)/vlength(b) end