From 2c7ba2642519192bdfb77a4ffa26b16640ab5f77 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 8 May 2013 02:42:47 -0400 Subject: [PATCH] Add the spectral_radius() function. --- spectral_radius.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spectral_radius.m diff --git a/spectral_radius.m b/spectral_radius.m new file mode 100644 index 0000000..47cfd72 --- /dev/null +++ b/spectral_radius.m @@ -0,0 +1,17 @@ +function rho = spectral_radius(A) + % + % Compute the spectral radius of ``A``, which is not necessarily + % Hermitian. + % + % This is slow. Don't use it on big matrices. + % + % INPUT: + % + % ``A`` -- The matrix whose spectral radius you want. + % + % OUTPUT: + % + % ``rho`` -- The spectral radius of ``A``. + % + rho = max(abs(eig(A))); +end -- 2.43.2