Skip to content

Commit

Permalink
add function 'expmat' ('expm' in <= v0.6, 'exp' in >= v0.7)
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Aug 12, 2018
1 parent 3bb074d commit e079b0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ if VERSION < v"0.7-"
@inline function _At_mul_B(A, B)
return At_mul_B(A, B)
end
expmat = expm
else
using SparseArrays, LinearAlgebra
import LinearAlgebra: norm, checksquare, LAPACKException, SingularException,
eye, ×
@inline function _At_mul_B(A, B)
return transpose(A) * B
end
expmat = exp
end
4 changes: 2 additions & 2 deletions test/unit_ExponentialMap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ for N in [Float64, Float32]
σ(sparsevec(d), emap)

# check consistency with respect to explicit computation of the matrix exponential
svec_explicit = σ(d, expm(Matrix(m)) * b)
svec_explicit = σ(d, expmat(Matrix(m)) * b)
if N == Float64
# precision with Float32 is not sufficient
@test svec svec_explicit
Expand Down Expand Up @@ -114,7 +114,7 @@ for N in [Float64, Float32]
σ(sparsevec(d), projmap)

# check consistency with respect to explicit computation of the matrix exponential
P = L * expm(Matrix(m)) * R
P = L * expmat(Matrix(m)) * R
svec_explicit = σ(d, P*b)
@test svec svec_explicit
end

0 comments on commit e079b0a

Please sign in to comment.