Example: Eigensystem Analysis

The eigenvalues and eigenvectors of a matrix are computed.
import com.imsl.math.*;

public class EigenEx1 {
    public static void main(String args[]) throws
    Eigen.DidNotConvergeException {
        double	a[][] = {
            { 8, -1, -5},
            {-4,  4, -2},
            {18, -5, -7}
        };
        Eigen eigen = new Eigen();
        eigen.solve(a,true);
        new PrintMatrix("Eigenvalues").print(eigen.getValues());
        new PrintMatrix("Eigenvectors").print(eigen.getVectors());
    }
}

Output

Eigenvalues
    0    
0  2+4i  
1  2-4i  
2  1     

             Eigenvectors
        0             1          2    
0  0.316-0.316i  0.316+0.316i  0.408  
1  0.632         0.632         0.816  
2      0-0.632i      0+0.632i  0.408  

Link to Java source.