Coder Social home page Coder Social logo

expokit.jl's People

Contributors

acroy avatar garrison avatar giggleliu avatar mforets avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

expokit.jl's Issues

Influence of `anorm` on performance of `expmv` and `phimv`?

In PR #30 , we find the variable anorm = norm(A, Inf) in expmv function does not affect the correctness and performance of the program.

As norm function is not designed for a general Linear Operator, it is natural to ask what it is used for and whether it should be required?

Fail "sometimes" in unitary transformation

I was using Expokit to compute some unitary transformations. However, I found out that the output is wrong "sometime".

using Expokit

badk = zeros(Int64, 0)
badx = Array{Array{Float64,1}}(0)
for k in 1:1000
    x = expmv(-0.1, sparse(9:-1:1, 1:9, -4:4), ones(9))
    if norm(x) > 4
        push!(badk, k)
        push!(badx, x)
    end
end

length(badk)

sparse(9:-1:1, 1:9, -4:4) is just a 9x9 skew-symmetric matrix, then its exponential is a unitary/orthonormal matrix. Therefore norm(x) should be approximately norm(ones(9)) = 3.

Depending on you luck, you will get non-empty badk above.
It happens on my Macbook as well as my office linux computing server.

screenshot 2017-11-25 23 51 52

Cannot exponentiate complex matrices

In Julia v0.3.5 I get:

In[41]: expmv(π/4,[0 -1im; 1im 0]|>sparse,[1.;0.])
InexactError()
while loading In[41], in expression starting on line 1

 in setindex! at array.jl:307
 in A_mul_B! at linalg/sparse.jl:24
 in expmv! at /home/msilva/.julia/v0.3/Expokit/src/Expokit.jl:71
 in expmv! at /home/msilva/.julia/v0.3/Expokit/src/Expokit.jl:20

expmv vs. expv

In Julia 1.0 the matrix exponential is done via exp and not expm as before. To have a consistent naming I would suggest to rename expmv and phimv.

norm(matrix) -> opnorm(matrix) in Julia 0.7

It looks like may be using norm(matrix). In Julia 0.7, this will compute the Frobenius norm (vecnorm in Julia 0.6), due to JuliaLang/julia#27401. If you want the induced/operator norm as in Julia 0.6, use opnorm(matrix) instead, or Compat.opnorm(matrix) to work in 0.6 and 0.7 (JuliaLang/Compat.jl#577).

Note that, for testing purposes, rather than @test norm(A - B) ≤ tol, it is usually preferred to do @test A ≈ B or @test A ≈ B rtol=... (which uses isapprox).

Tag a new release

A bug that was fixed probably in #25 still exists in the current release version of Expokit.jl that people download with Pkg.add("Expokit"). I suggest to make a new release soon.

(the error was found again here)

Benchmarks

As briefly discussed in #9 and #18 having benchmarks of a couple of "real world problems" would be nice. Some suitable examples are provided in this paper, among them the 3D quantum harmonic oscillator. Additionally, @mforets suggested to "use Hurwitz-stable matrices arising from control systems".

New benchmarks should go into the folder benchmarks/ and this issue can be used for discussions.

Non-allocating versions of expm and phim

It would be nice if there could be an optional argument for the Krylov vectors so that way if this is called in a loop the caches don't need to be created each time.

Roadmap

as a step forward what do you think about:

  • add more functionality:
  • make docs
  • register the package
  • benchmarks #21

CC: @acroy, @garrison

Add phimv

The phimv function, phiv in Expokit, computes the solution of a nonhomogeneous linear ODE without direct evaluation of a matrix exponential.

May various algorithms be in the repo

As started in another thread, the expmv() function can also be written in the Al-Mohy's algorithm (A. H. Al-Mohy and N. J. Higham. Computing the action of the matrix exponential, with an application to exponential integrators. MIMS EPrint 2010.30, The University of Manchester, 2010; SIAM J. Sci. Comput.), beyond the Krylov, Chebyshev and other usual methods. The MATLAB implementation of the Al-Mohy algorithm (with intensive for-loops) and a C rewritten can be found here and here. It would be good to compare those different methods in Julia and provide parametric interface to competitive algorithms. See also the roadmap of IterativeSolvers.jl.

Similar calls to expmv and expm return very different results

This happens even for 2x2 matrices, and affects complex and real matrices equally

julia> expm(pi/4*[0 1; 1 0])*[1.;0.]
2-element Array{Float64,1}:
 1.32461 
 0.868671

julia> expmv(pi/4,[0 1; 1 0]|>sparse, [1.;0.])
2-element Array{Float64,1}:
 1.19636
 0.65672

julia> expm(-pi/4*1im*[0 1; 1 0])*[1.;0.]
2-element Array{Complex{Float64},1}:
 0.707107+0.0im     
      0.0-0.707107im

julia> expmv(pi/4,-1im*[0 1; 1 0]|>sparse, [1.;0.])
2-element Array{Complex{Float64},1}:
 0.815705+0.0im     
      0.0-0.578469im

Add padm

The function padm from Expokit computes the matrix exponential exp(A) of a large sparse matrix using Pade approximants.

A preliminary version is in this branch. Some results are here.

Avoid \ for non-allocating

When trying to avoid allocations, note that \ actually allocates. You will instead want to use A_ldiv_B! for the non-allocating form.

Add chbv

Maybe we should also add chbv for completeness. Seems to be straight-forward.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.