comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: 'vectorizing functions'
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: 'vectorizing functions' [message #52498] Tue, 06 February 2007 15:34
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
Encode all vectors as 2xn. Change CALCULATE_LENGTH to:

sqrt(total(vector^2,1))

Change CALCULATE_ANGLE to:

l2=length1*length2
zero=l2 eq 0.0
cos_theta=total(vector1*vector2,1)/(l2+zero)

Note I change from matrix multiplication to TOTAL for the dot product,
then add 1 to the denominator whenever the length is zero (which means
the dot product is zero as well).

JD
[Message index]
 
Read Message
Previous Topic: Mask to ROI
Next Topic: unit testing for IDL?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:32:59 PDT 2025

Total time taken to generate the page: 0.00427 seconds