Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jacobian! #88

Closed
PerezHz opened this issue Mar 3, 2017 · 7 comments
Closed

Add jacobian! #88

PerezHz opened this issue Mar 3, 2017 · 7 comments

Comments

@PerezHz
Copy link
Contributor

PerezHz commented Mar 3, 2017

Related to TaylorIntegration's PR #18. For performance reasons, it would be good to have an in-place evaluation version of jacobian in TaylorSeries. My proposal is something like this:

function jacobian!{T<:Number}(jjac::Array{T,2}, vf::Array{TaylorN{T},1})
    numVars = get_numvars()
    @assert length(vf) == numVars

    for comp = 1:numVars
        jjac[comp,:] = vf[comp].coeffs[2].coeffs[1:end]
    end

    nothing
end

As far as I've tested it, this change improves memory use on TaylorIntegration Lyapunov spectrum methods, in particular stabilitymatrix!, where jacobian is currently used.. Perhaps this could be included in #87 ?

@PerezHz
Copy link
Contributor Author

PerezHz commented Mar 3, 2017

This version is even faster:

function jacobian!{T<:Number}(jjac::Array{T,2}, vf::Array{TaylorN{T},1})
    numVars = get_numvars()
    @assert length(vf) == numVars

    for comp2 = 1:numVars
        for comp1 = 1:numVars
            jjac[comp1,comp2] = vf[comp1].coeffs[2].coeffs[comp2]
        end
    end

    nothing
end

Edit: I was messing with the indices, now it should work fine

@lbenet
Copy link
Member

lbenet commented Mar 3, 2017

Can you send a PR, with tests? I'm actually spending some time in this kind of tricks...

@lbenet
Copy link
Member

lbenet commented Mar 3, 2017

Regarding #87, if you are in a hurry, just send it using the current master.

@PerezHz
Copy link
Contributor Author

PerezHz commented Mar 7, 2017

PR #91 is an attempt to implement inplace evaluation versions of jacobian and hessian 😄

@PerezHz
Copy link
Contributor Author

PerezHz commented Mar 7, 2017

Closed by PR #91

@PerezHz PerezHz closed this as completed Mar 7, 2017
@lbenet
Copy link
Member

lbenet commented Mar 8, 2017

Done it, though not in a clean way; you'll have to git pull -f...

@lbenet
Copy link
Member

lbenet commented Mar 8, 2017

... on that branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants