Closed jarlebring closed 3 years ago
Concerning the expm versions: The comparison in the BBC-paper: https://doi.org/10.3390/math7121174 contains these expm-versions:
The notation expm2005
, expm2009
, expm2016
, seems natural.
Question (maybe for @mfasi): Are there better/other versions now? Which version is in Julia?
As far as I understand, tweaks like in expm2016
are for problems which are not the main the main target class for us. I think we can probably do these tweaks but nothing is gained from the graph viewpoint.
Are there better/other versions now?
There is a multiprecision version published in 2019, but even though we run some experiments in double precision there I doubt that algorithm would be of interest in this context. A more relevant recent implementation for double precision is in this paper, which is already in the list above.
Which version is in Julia?
Julia implements the version in the book Functions of Matrices: Theory and Computation, which is essentially expm2005 in this paper. For reference, the code is here.
I implemented a function for generating rational functions, rather than calling it Padé, but ticked to pade.jl
-box anyway.
How do we want scaling
to work for the polynomial generators?
Do we want the behavior to align across different methods?
Currently the scaling works a bit different among them. For ps_poly
and monomial
the scaling is purely applied to the coefficients (in cref
). Hence, if new coefficients are set (using the returned cref
), then the scaling disappear.
However, in horner
the scaling is mostly (but not completely!) applied to the other coefficients (not part of cref
). Hence, if new coefficients are set (using cref
), then it is difficult to overlook what polynomial is evaluated.
How do we want
scaling
to work for the polynomial generators? Do we want the behavior to align across different methods?
I would say no. Different methods have different ways of naturally doing a scaling. Not all methods need to have scaling. If scaling can be achieved by preprocessing, it seems too basic to have as a feature.
What do we want in the cref
for Newton–Schultz? I currently left it empty.
What do we want in the
cref
for Newton–Schultz? I currently left it empty.
Let's decide when we reconnect with simulations based on that function.
I am currently looking into the expm2009
from this paper . It seems to need some 1-norm estimation. The reference code from BBC uses the matlab-function normest1
. Does anyone know if there is such functionality in Julia? Or should we implement something like this? I can only find old references to norm-estimation in the Julia standard library. Perhaps @mfasi knows, you seemed to have been involved in some of the discussions.
I can confirm that the functionality is not in Julia. Several people tried to get that algorithm into Base, but we all failed.
The most recent implementation, I think, is the one you can find in this PR, specifically here. This function estimates the 1-norm of a matrix given explicitly, whereas for expm
we need to estimate the 1-norm of a matrix given only a function that computes the action of that matrix (and its conjugate transpose) on a vector, but it's close enough.
If you're OK with that, I can implement that function, as I've already worked with that algorithm and have an idea of how it should work. If you want to use the functionality in the mean time, you can probably just define a one-liner that computes the 1-norm of the p
th power of A
instead of estimating it:
# Estimate 1-norm of A^p.
opnormAp(A::Matrix,p::Integer)=opnorm(A^p,1)
If you're OK with that, I can implement that function, as I've already worked with that algorithm and have an idea of how it should work. If you want to use the functionality in the mean time, you can probably just define a one-liner that computes the 1-norm of the
p
th power ofA
instead of estimating it:
That would be great! I did a line-by-line conversion of the expm2009
code and simply added a placeholder here.
I had a talk with @jarlebring and we thought that all the glue-code for expm2009
is possibly not needed in the generators. Later we might try to add it to generated code, but for now we halt this. @mfasi no need to implement an 1-norm estimator.
Sorry for not following this thread carefully. I didn't realize the 1-norm estimator work was initiated. As I mentioned to Emil, I think the glue code for graph selection needs separate attention (e.g. we think through how it best fits with the generated code), and is maybe less central for this package which is focused on graphs rather than selecting the correct graph.
I implemented the code for 1-norm estimation, but won't commit it to the repository as it is not clear whether we're gonna need it or not. For now, it's in this gist.
Thanks! It will probably be useful for glue-code later
Moved the sastre code gen to #30. Closes this issue.
When we transfer graph generators to github, I suggest we use the opportunity to improve the code.
(graph,cref)
gen_X()
: generates a graph corresponding to technique X, orgen_X_F()
: generates a graph corresponding to technique X for matrix function FT=Float64
. (see example in Denman-Beavers c433773 ) unless given implicitly by other parameters.To-do list for generators:
gen_denman_beavers
(from dropbox denman_beavers.jl. removecref_mode
-kwarg)gen_monomial
frommonomial_graph_gen()
. Replace explicit summing with call toadd_sum!
(Maybe there is a better name than monomial, e.g.monomial_poly
)gen_pade
. Replace explicit summing to a call to one of the polynomial functions (user can specifygen_monomial
,gen_ps
, etc)gen_ps
newton_schulz_graph_gen.jl
:gen_newton_schulz
. Should return(graph,cref)
.horner_graph_gen.jl
->gen_horner
. Make kwargs consistent withgen_monomial
. Return two(graph,cref)
add_sum!
.expm2009: calladd_sum!
.sastre exponential: The exponential of sastres paper, with hard-coded coeffs. Callgen_general_poly_recursion
.sastre general. The general function for sufficiently smallp
. Callgen_general_poly_recursion
.gen_general_poly_recursion
.gen_general_poly_recursion
.