Library: | math |
See also: | eiscg eisrg eigsm |
Quantlet: | eisrs | |
Description: | computes the eigenvalues and eigenvectors of a real symmetric matrix |
Usage: | eig = eisrs(a) | |
Input: | ||
a | n x n matrix | |
Output: | ||
eig.w | n x 1 vector of eigenvalues | |
eig.z | n x n matrix of eigenvectors |
library("math") y1 = #(1, -1, 0) y2 = #(-1, 2, -1) y3 = #(0, -1, 1) a = y1~y2~y3 eig = eisrs(a) eig.w ; eigenvalues eig.z ; eigenvectors
Contents of w [1,] -1.5934e-16 [2,] 1 [3,] 3 Contents of z [1,] 0.57735 0.70711 0.40825 [2,] 0.57735 -1.8229e-16 -0.8165 [3,] 0.57735 -0.70711 0.40825 The exact values of elements that are close to zero (e.g., w[1], z[2,2]) can differ dependent on your CPU.