Skip to content

Commit e4f2e9c

Browse files
committed
Support StaticArrays
This package is almost ready to be used straight up with StaticArrays. Most variables are already written in a general way, there are just two blockers: The preallocated buffers `JJ` and `n_buffer`, aswell as the LMResults type. This commit fixes that, and almost allows usage of StaticArrays. However, there's still JuliaDiff/DiffResults.jl#25, but that can be currently overcome by two typedefs.
1 parent 85d2165 commit e4f2e9c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/levenberg_marquardt.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ end
2727

2828
struct LMResults{O,T,Tval,N}
2929
method::O
30-
initial_x::Array{T,N}
31-
minimizer::Array{T,N}
30+
initial_x::AbstractArray{T,N}
31+
minimizer::AbstractArray{T,N}
3232
minimum::Tval
3333
iterations::Int
3434
iteration_converged::Bool
@@ -146,8 +146,8 @@ function levenberg_marquardt(
146146
# Create buffers
147147
n = length(x)
148148
m = length(value(df))
149-
JJ = Matrix{T}(undef, n, n)
150-
n_buffer = Vector{T}(undef, n)
149+
JJ = transpose(jacobian(df))*jacobian(df)
150+
n_buffer = similar(x)
151151
Jdelta_buffer = similar(value(df))
152152

153153
# and an alias for the jacobian

0 commit comments

Comments
 (0)