You have a solution for checking for a symmetric matrix.
For the eigenvectors, see the documentation for eig
as suggested by Luis Mendo, but also the documentation for eigs
, which allows you to request k
eigenvectors according to sigma
:
eigs(A,k,sigma)
where sigma
can be:
'lm'
Largest magnitude (default).
'sm'
Smallest magnitude. Same as sigma = 0.For real symmetric problems, the following are also options:
'la'
Largest algebraic ('lr' )
'sa'
Smallest algebraic ('sr' ) 'be' Both ends (one more from high end if k is odd)
Using eigs
with the k
syntax should be marginally easier than eig
, but either will work.