BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Amink
Fluorite | Level 6

I got an eigenvector of a matrix and I need to normalize this vector but I don't know how. Anyone can help?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

If x + i*y is a complex vector, then the norm is 

|| x + i*y || =  (x+i*y)*(x-i*y) = sqrt(sum(x##2 + y##2) = sqrt(norm(x) + norm(y))

Thus, either of the following will work:

 

proc iml
/* For a complex vector x + i*y, the complex norm is 
   (x+i*y)*(x-i*y) = sqrt(x##2 + y##2)
*/
x = {1,  1, 3};
y = {2, -2, 0};

norm1 = sqrt( sum(x##2 + y##2) );
norm2 = sqrt(norm(x)**2 + norm(y)**2);
print norm1 norm2;

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

You can use the NORM() function in PROC IML (and then divide the vector itself by its NORM)

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=imlug&docsetTarget=imlug_...

--
Paige Miller
Amink
Fluorite | Level 6

Thanks so much

Rick_SAS
SAS Super FREQ

If you used SAS/IML to get the eigenvector, then it is already normalized. All eigenvectors have unit L2 norm.

 

If you got the vector from somewhere else, Paige gives the correct answer for real eigenvectors. 

 

If the eigenvector is complex, write back, and we can help with that.

 

Amink
Fluorite | Level 6

First thank you so much Rick

Actually I got my eigenvectors from sas/iml. However i like to learn more, so if you do not mind, could you please share how can i get normalized vectors if they are complex. 

Rick_SAS
SAS Super FREQ

If x + i*y is a complex vector, then the norm is 

|| x + i*y || =  (x+i*y)*(x-i*y) = sqrt(sum(x##2 + y##2) = sqrt(norm(x) + norm(y))

Thus, either of the following will work:

 

proc iml
/* For a complex vector x + i*y, the complex norm is 
   (x+i*y)*(x-i*y) = sqrt(x##2 + y##2)
*/
x = {1,  1, 3};
y = {2, -2, 0};

norm1 = sqrt( sum(x##2 + y##2) );
norm2 = sqrt(norm(x)**2 + norm(y)**2);
print norm1 norm2;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 6 replies
  • 1814 views
  • 2 likes
  • 4 in conversation