Download the Rational Krylov Toolbox

To automatically download and install the Rational Krylov Toolbox, simply copy and paste
the following two lines to your MATLAB command window:

 cd('rktoolbox'); addpath(fullfile(cd)); savepath

Alternatively, the toolbox can be downloaded manually from To install it, unpack the zip file and add the main folder 'rktoolbox' to your MATLAB path.


2.9 (latest)2020-07-14 BARYFUN: New class to represent rational functions in generalized barycentric form.
RKFUN contfrac updated to deal with type [1,1] rational functions.
Utility functions: util_block_aaa: AAA-like algorithm to compute approximants in BARYFUN form; util_rmse: helper function to evaluate root mean squared error; util_bilanczos: updated to deal with 1x1 matrices.
OTHER: New examples on block AAA and label propagation on graphs. Updated several references and the guide.
2.82019-02-25 RAT_KRYLOV: Fixed QR permutation to maintain column structure in the block case. Fixed issue with lucky breakdown in the real variant leading to a broken decomposition. Restructured breakdown tests and error messages. Allow simulation of parallelisation in the block case. Allow construction of RK space when xi = []. Now works with Advanpix MP Toolbox.
RKFIT: Adaptive degree increment when run with xi = [] until tolerance is reached.
Utility functions: Moved utility functions to main folder to simplify adding to path. util_bary2rkfun: corrected rng initialization; util_pencil_blocksize: improved documentation and changed to SVD for pole identification; move_poles_expl: changed ORDQZ call to use complex() in 3rd and 4th argument to avoid crash due to MATLAB 2018 bug.
OTHER: New examples on block Krylov methods (CD player MOR, vector autoregression, and block Ritz values of the Wilkinson matrix). Updated the guide.
2.72017-11-06 Added utility function util_bary2rkfun, util_aaa, util_matcell to work with barycentric approximants computed by the AAA algorithm.
RAT_KRYLOV: For the block-case, support to keep fat decompositions has been added, as well as Ruhe's QR-based continuation strategy (default). Balancing of matrix pencil (on by default).
OTHER: New example on AAA approximation and nonlinear eigenvalue problems. Updated the guide.
2.62017-03-03 RAT_KRYLOV: added support for generating and rerunning block rational Arnoldi decompositions.
RKFUNM: added class for matrix-valued RKFUN's with basic linearize method.
OTHER: util_pencil_poles now works for block pencils and returns poles in mp format if requested; new function util_nleigs for sampling a nonlinear eigenvalue problem into an RKFUNM; new functions util_qr and util_pencil_blocksizes for block Arnoldi.
2.52016-11-04 GALLERY: New rational approximants (SQRT0H, SQRT2H, INVSQRT2H) on two disjoint intervals and indefinite intervals.
RKFUN: Fixed erroneous normalization in rdivide
OTHER: New examples on Zolotatev problems by Alex Townsend and the compression of exterior Helmholtz problems; new utility functions util_colfun, util_dtnfun, util_log2lin, util_markovfunmv, util_recover_rad, util_reorder_poles.
2.42016-06-01 RAT_KRYLOV Can now simulate the parallel generation of basis vectors using various continuation strategies; see also [5].
GALLERY: Fixed bug concerning the rational approximants SQRT, SIGN, and STEP (thanks to R. Luce and A. Townsend for pointing these out) and improved accuracy of these approximants.
OTHER: Four new examples on the parallel Arnoldi method and related new utility function util_continuation_fom; utility functions util_ellipjc and util_ellipkkp from the SC Toolbox [6].
2.32016-03-06 DIFF: Removed infinite generalized eigenvalues for the sampling (same in EZPLOT). Now supports MP, uses real Jordan form for real-valued (quasi) RADs.
FEVAL: Now works with quasi RADs. More efficient evaluation of r(A,V) for a block of vectors V.
RKFIT: Removed bug related to 'best'/'last' flag (was off by one index).
OTHER: Two new examples (FEAST, complex networks).
2.22015-09-28 RKFIT: changed default iteration number to 10; added return option to output 'best' (default) or 'last' approximant
RKFUN: reworked constructor and added support for symbolic strings; added gallery with Zolotarev rational functions, Moebius transforms, etc.; added support for composition with Moebius transforms, addition, multiplication, division, exponentiation; inverse function of Moebius transform; Newton correction in roots and 'real' option, also now using util_householder; now using some private functions; diff now samples at standard Ritz values
MOVE_POLES_IMPL: added 'real' option
OTHER: new front web page; new example on rational filter design; Content.m and License.txt files added; restructured the test folder and added several new tests
2.12015-07-14 RAT_KRYLOV: added option for a waitbar;
RKFIT: fixed reduction strategy to achieve scaling-invariance for F and b;
OTHER: new utility functions (util_discretise_polygon, util_linearise_nlep), new examples on (non)linear eigenvalue problems and the semiseparable structure of rational Krylov projections
2.02015-06-13 RAT_KRYLOV: new pencil structure for (A,B) supported, allowing the use of function handles; allows for rerunning an existing rational Arnoldi decomposition; allows to expand an existing decomposition; parameter structure; supports classical and modified GS with or without reorthogonalisation; can do one iteration of iterative refinement for the linear system solves; fixed bug with near 0 poles;
HH2TH: can now deal with real-valued quasi-Hessenberg pencils;
RKFIT: generalized to nondiagonal approximants; automated degree reduction; allows for multiple "functions" F and a block of vectors in b; allows for weighting matrices D; changed to relative misfit; added output structure for more insight; rational function now returned as an RKFUN object; added utility function to convert data to real form if possible;
RKFUN: more efficient evaluation via rerunning; implemented as a class with 24 new methods; including root-finding, conversion to partial fraction form, and differentiation;
OTHER: new utils subfolder; added several examples and tests
1.02015-02-04First version of the toolbox

Planned features

The Rational Krylov Toolbox is under continuous development and new features will be added over time. Here is our current todo list:


This web site was generated using MATLAB's publish command. The convenient 2-line Matlab code for automated download and installation of this toolbox was adapted from a similar code on the Chebfun website.

We are grateful to Pavel Holoborodko for providing and maintaining the powerful Advanpix multiprecision toolbox [1], and to Toby Driscoll for allowing us to include two elliptic function routines from [6]. We thank Yuji Nakatsukasa, Oliver Sete, and Nick Trefethen for the permission to include the AAA algorithm [8] as a utility function in the toolbox.

We also acknowledge contributions to the example collection by Mary Aprahamian, Ion Victor Gosea, and Alex Townsend.


[1] Advanpix LLC., Multiprecision Computing Toolbox for MATLAB, ver, Tokyo, Japan, 2017.

[2] M. Berljafa, S. Elsworth, and S. Güttel, A Rational Krylov Toolbox for MATLAB, MIMS EPrint 2014.56, Manchester Institute for Mathematical Sciences, The University of Manchester, UK, 2014. Available at

[3] M. Berljafa and S. Güttel, Generalized rational Krylov decompositions with an application to rational approximation, SIAM J. Matrix Anal. Appl., 36(2):894--916, 2015.

[4] M. Berljafa and S. Güttel, The RKFIT algorithm for nonlinear rational approximation, SIAM J. Sci. Comput., 39(5):A2049--A2071, 2017.

[5] M. Berljafa and S. Güttel, Parallelization of the rational Arnoldi algorithm, SIAM J. Sci. Comput., 39(5):S197--S221, 2017.

[6] T. A. Driscoll, A MATLAB toolbox for Schwarz-Christoffel mapping, ACM Trans. Math. Soft., 22:168--186, 1996.

[7] S. Güttel and L. Knizhnerman, A black-box rational Arnoldi variant for Cauchy--Stieltjes matrix functions, BIT Numer. Math., 53(3):595--616, 2013.

[8] Y. Nakatsukasa, O. Sete, and L. N. Trefethen, The AAA algorithm for rational approximation, SIAM J. Sci. Comput., 40(3):A1494--A1522, 2018.

[9] A. Ruhe, Rational Krylov: A practical algorithm for large sparse nonsymmetric matrix pencils, SIAM J. Sci. Comput., 19(5):1535--1551, 1998.