We are proud to announce the first release of the package GraphMatFun.jl
. This package contains functionality to represent, manipulate and optimize algorithms for matrix functions using directed acyclic graphs. It also contains code-generation features for several languages (Julia, MATLAB, C/BLAS).
The Padé-based scaling and squaring algorithm is represented in this way:
The package has a corresponding manuscript and data files repository. In the data repository you can download optimized graphs and generated code to be used directly in computations. For example, the matrix exponential can in many cases be computed more efficiently than the native implementation:
julia> using GraphMatFun, BenchmarkTools, LinearAlgebra;
julia> # Download from https://github.com/matrixfunctions/GraphMatFunData/tree/main/data/generated/exp
julia> include("exp_sid_m5_opt_rho1_9.jl");
julia> A=randn(1000,1000); A=1.8*A/norm(A);
julia> E1=@btime exp($A);
1.111 s (23 allocations: 76.31 MiB)
julia> E2=@btime exp_sid_m5_opt_rho1_9($A);
332.667 ms (19 allocations: 68.67 MiB)
julia> norm(E1-E2)/norm(E2)
3.1592474046054336e-16