• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Perl question, normalizing PDL vector

RichieZ

Diamond Member
"The formula for calculating the cosine is:

cos = ( V1 * V2 ) / ||V1|| x ||V2||

...where V2 and V2 are our vectors, the vertical bars indicate the 2-norm, and the * indicates the inner product.

Check out http://pdl.sourceforge.net/PDLdocs/Primitive.html for some help here."

The doc says:
norm
Signature: (vec(n); [o] norm(n))
Normalises a vector to unit Euclidean length


I don't understand the syntax and there are no examples.

Lets say I have a reference to a PDL vector (my $vec), coudl somebody give me an example of how to use the norm routine to normalize it?
 
Back
Top