X-Git-Url: http://gitweb.michael.orlitzky.com/?p=octave.git;a=blobdiff_plain;f=spectral_radius.m;fp=spectral_radius.m;h=47cfd726e4681e28f89562e325f9c6ebeb45e29f;hp=0000000000000000000000000000000000000000;hb=2c7ba2642519192bdfb77a4ffa26b16640ab5f77;hpb=fb5be501fba46b17fec32d786aac2ad3f6f9ee0a 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