Skip to content

Commit

Permalink
Support StaticArrays
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RomeoVAirbus committed Aug 15, 2023
1 parent 85d2165 commit e4f2e9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/levenberg_marquardt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ end

struct LMResults{O,T,Tval,N}
method::O
initial_x::Array{T,N}
minimizer::Array{T,N}
initial_x::AbstractArray{T,N}
minimizer::AbstractArray{T,N}
minimum::Tval
iterations::Int
iteration_converged::Bool
Expand Down Expand Up @@ -146,8 +146,8 @@ function levenberg_marquardt(
# Create buffers
n = length(x)
m = length(value(df))
JJ = Matrix{T}(undef, n, n)
n_buffer = Vector{T}(undef, n)
JJ = transpose(jacobian(df))*jacobian(df)
n_buffer = similar(x)
Jdelta_buffer = similar(value(df))

# and an alias for the jacobian
Expand Down

0 comments on commit e4f2e9c

Please sign in to comment.