Computation graph for matrix functions
Matrix functions, such as the matrix exponential, matrix square root, the sign-function, are fundamental concepts that appear in wide range of fields in science and technology. In this talk, the evaluation of matrix functions is viewed as a computational graphs. More precisely, by viewing methods as directed acyclic graphs (DAGs) we can improve and analyze existing techniques them, and derive new more efficient algorithms. The accuracy of these matrix techniques can be characterized by the accuracy of their scalar counterparts, thus designing algorithms for matrix functions can be treated as a scalar-valued optimization problem. The derivatives needed during the optimization can be calculated automatically by exploiting the structure of the DAG, in a fashion analogous to backpropagation. These functions and many more features are implemented in GraphMatFun.jl, a Julia package that offers the means to generate and manipulate computational graphs, optimize their coefficients, and generate Julia, MATLAB, and C code to evaluate them efficiently at a matrix argument. The software also provides tools to estimate the accuracy (including backward error) of a graph-based algorithm and thus obtain numerically reliable methods. For the exponential, for example, using a particular form (degree-optimal) of polynomials produces implementations that in many cases are cheaper, in terms of computational cost, than the Padé-based techniques typically used in mathematical software. The optimized graphs and the corresponding generated code are available online.