matrixfunctions / GraphMatFun.jl

Computation graphs for matrix functions
MIT License
13 stars 0 forks source link

Rename node for `:A` #38

Closed jarlebring closed 3 years ago

jarlebring commented 3 years ago

This throws an error and I don't see why it should not work:

julia> rename_node!(g,:A,:A2tmp)
julia> add_mult!(g,:A2tmp,:A,:A)

This way we can change the input, i.e., if you want to compute the cosine function you can do polynomial evaluation p(x^2) where p stems from the non-zero coeffs of the taylor exp of cos.

mfasi commented 3 years ago

This sounds useful. I guess it's intended to work only if the node :A is already used by some "operation" node (mult, lincomb, or ldiv) when rename_node! is called, correct?

jarlebring commented 3 years ago

Now I think I understand. You suggest the function should fail based on srcnode in relevantnodes where something like

relevantnodes=[keys(g.parents)...;
                         getindex.(values(g.parents),1);
                         getindex.(values(g.parents),2)]

Sound good!

mfasi commented 3 years ago

OK, I'll give it a go!