Matrix Eigenvalues in Perl Don't Get Much Easier

| | Comments (0) | TrackBacks (0)
The Matrix subsystem has really grown up in the last few days since the 0.16 release, including easy-to-use methods to calculate Matrix eigenvalues. All kinds of other methods are now available, like
my $det1 = $A->det;      # determinant
my $det2 = abs $A;       # determinant

my $inv = $A->inverse;  
my @eigs = $A->eigenvalues;

my ($eigenvalues, $eigenvectors) = $matrix->eigenpair;
my ($eig1,$eig2) = @$eigenvalues;
my ($u,$v)       = @$eigenvectors;
Compare this new script for calculating eigenvalues and eigenvectors of a nonsymmetric matrix to the old version. Yes, quite an improvement and quite pleasing to the eye now. Note that $A->eigenvalues; returns a list of Math::Complex objects because in general the eigenvalues of a real matrix can be complex. Only if your matrix is symmetric are you guaranteed real eigenvalues.

0 TrackBacks

Listed below are links to blogs that reference this entry: Matrix Eigenvalues in Perl Don't Get Much Easier.

TrackBack URL for this entry:

Leave a comment

About this Entry

This page contains a single entry by Jonathan Leto published on December 25, 2008 11:53 AM.

Math::GSL 0.16 - More features and more rigorous tests was the previous entry in this blog.

Math::GSL 0.17_01 on CPAN is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Screw you, spammers! Clicky Web Analytics