GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Math::GSL::Eigen(3) User Contributed Perl Documentation Math::GSL::Eigen(3)

Math::GSL::Eigen - Functions for computing eigenvalues and eigenvectors of matrices

use Math::GSL::Eigen qw/:all/;

Here is a list of all the functions included in this module :

This module also includes these constants :

$GSL_EIGEN_SORT_VAL_ASC - ascending order in numerical value
$GSL_EIGEN_SORT_VAL_DESC - descending order in numerical value
$GSL_EIGEN_SORT_ABS_ASC - ascending order in magnitude
$GSL_EIGEN_SORT_ABS_DESC - descending order in magnitude

For more informations on the functions, we refer you to the GSL official documentation: <http://www.gnu.org/software/gsl/manual/html_node/>

This example shows how to use the gsl_eigen_symmv functions to find the eigenvalues and eigenvectors of a matrix.

 use Math::GSL::Vector qw/:all/;
 use Math::GSL::Matrix qw/:all/;
 use Math::GSL::Eigen qw/:all/;
 my $w = gsl_eigen_symmv_alloc(2);
 my $m = gsl_matrix_alloc(2,2);
 gsl_matrix_set($m, 0, 0, 2);
 gsl_matrix_set($m, 0, 1, 1);
 gsl_matrix_set($m, 1, 0, 1);
 gsl_matrix_set($m, 1, 1, 2);
 my $eval = gsl_vector_alloc(2);
 my $evec = gsl_matrix_alloc(2,2);
 gsl_eigen_symmv($m, $eval, $evec, $w);
 gsl_eigen_gensymmv_sort($eval, $evec, $GSL_EIGEN_SORT_ABS_ASC);
 print "The first eigenvalue is : " . gsl_vector_get($eval, 0) . "\n";
 print "The second eigenvalue is : " . gsl_vector_get($eval, 1) . "\n";
 my $x = gsl_matrix_get($evec, 0, 0);
 my $y = gsl_matrix_get($evec, 0, 1);
 print "The first eigenvector is [$x, $y] \n";
 $x = gsl_matrix_get($evec, 1, 0);
 $y = gsl_matrix_get($evec, 1, 1);
 print "The second eigenvector is [$x, $y] \n";

Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>

Copyright (C) 2008-2021 Jonathan "Duke" Leto and Thierry Moisan

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2025-07-03 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.