Skip to content

Commit

Permalink
Release 4.0.0
Browse files Browse the repository at this point in the history
* Remove deprecated stuff (gauss-newton iterator; store cost & trajectory in options/result)
* Remove unused marginalization code
* Remove visual geometry functionality (and VisualGeometryDatasets dependency)
  • Loading branch information
ojwoodford authored Nov 4, 2023
1 parent 8c4e76e commit 4a372d6
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 870 deletions.
6 changes: 2 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NLLSsolver"
uuid = "50b5cf9e-bf7a-4e29-8981-4280cbba70cb"
authors = ["Oliver Woodford"]
version = "3.3.2"
version = "4.0.0"

This comment has been minimized.

Copy link
@ojwoodford

ojwoodford Nov 4, 2023

Author Owner

[deps]
DiffResults = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
Expand Down Expand Up @@ -30,15 +30,13 @@ SparseArrays = "1.6"
Static = "0.8.7"
StaticArrays = "1"
Test = "1.6"
VisualGeometryDatasets = "0.2.1"
julia = "1.6"

[extras]
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
VisualGeometryDatasets = "962a53e2-84f2-440b-bfbc-4e96ec28357f"

[targets]
examples = ["GLMakie", "VisualGeometryDatasets"]
examples = ["GLMakie"]
test = ["Test", "Random"]
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ Various optimizer `options` can be defined. During optimization, the optimizer u
## Examples
The following examples of problem definition, creation and optimization are included:
- **Rosenbrock function** (examples/rosenbrock.jl): Visualizes optimization of the Rosenbrock function using some of the available optimizers. Click on the parameter space to interactively select a new start point.
- **Bundle adjustment** (examples/bundleadjustment.jl): Optimization of large scale [Bundle Adjustment in the Large](https://grail.cs.washington.edu/projects/bal/) problems, with non-Euclidean variables.

## Future work & collaboration
- **Add Schur complement** to speed up optimization of bipartite problems.
- **Add Variable Projection method** for solving bipartite problems.
- **Implement reduced memory Variable Projection** for solving very large scale bipartite problems.
- **Allow residuals to dynamically change the variables they depend on** to broaden the types of problems that can be optimized.
- **Allow residual blocks to depend on a dynamic number of variables** to further broaden the types of problems that can be optimized.
- **Add additional solvers**
Expand Down
135 changes: 0 additions & 135 deletions examples/bundleadjustment.jl

This file was deleted.

10 changes: 2 additions & 8 deletions src/NLLSsolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ export NLLSProblem, NLLSOptions, NLLSResult, NLLSIterator # Concrete problem & s
export AbstractRobustifier, NoRobust, Scaled, HuberKernel, Huber2oKernel, GemanMcclureKernel # Robustifiers
export ContaminatedGaussian # Adaptive robustifiers
export EuclideanVector, ZeroToInfScalar, ZeroToOneScalar # Concrete general variables
export Rotation3DR, Rotation3DL, Point3D, Pose3D, EffPose3D, UnitVec3D, UnitPose3D # Concrete 3D geometry variable types
export SimpleCamera, NoDistortionCamera, ExtendedUnifiedCamera, BarrelDistortion, EULensDistortion # Concrete camera sensor & lens variable types
export SimpleError2, SimpleError3, SimpleError4 # Measurement error residuals depending on 2, 3, and 4 variables
export CostTrajectory # Object for storing opimization trajectory and costs
# Functions
export addcost!, addvariable!, updatevarcostmap!, subproblem, subproblem!, nvars, nres # Construct a problem
export update, nvars # Variable interface
export nres, ndeps, varindices, getvars # Residual interface
export nres, ndeps, varindices, getvars, generatemeasurement # Residual interface
export robustkernel, robustify, robustifydcost, robustifydkernel # Robustifier interface
export cost, computeresidual, computeresjac, computecost, computecostgradhess # Compute the objective
export optimize! # Optimize the objective
export rodrigues, project, epipolarerror, proj2orthonormal # Multi-view geometry helper functions
export ideal2image, image2ideal, pixel2image, image2pixel, ideal2distorted, distorted2ideal, convertlens
export nullcallback, printoutcallback, storecostscallback # Callbacks to be called once per optimization iteration

# Exported abstract types
Expand All @@ -42,8 +39,6 @@ include("problem.jl")

# Variables
include("variable.jl")
include("visualgeometry/camera.jl")
include("visualgeometry/geometry.jl")

# Types
include("BlockSparseMatrix.jl")
Expand All @@ -53,7 +48,6 @@ include("structs.jl")

# Optimization
include("residual.jl")
include("marginalize.jl")
include("robust.jl")
include("robustadaptive.jl")
include("autodiff.jl")
Expand Down
20 changes: 0 additions & 20 deletions src/autodiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,3 @@ computegradhesshelper(varflags, residual, vars, x) = computecost(residual, updat
@inline autorobustifydcost(kernel::AbstractRobustifier, cost) = computehessian(Base.Fix1(robustify, kernel), cost)
@inline autorobustifydkernel(kernel::AbstractAdaptiveRobustifier, cost::T) where T = computehessian(fixallbutlast(computerobustgradhesshelper, kernel, cost), zeros(SVector{nvars(kernel)+1, T}))
computerobustgradhesshelper(kernel, cost, x) = robustify(update(kernel, x), cost+x[end])

# Overloads of some specific functions
struct RotMatLie{T}
x::T
y::T
z::T
end

function rodrigues(x::T, y::T, z::T) where T<:ForwardDiff.Dual
@assert x == 0 && y == 0 && z == 0
return RotMatLie{T}(x, y, z)
end

du(x) = ForwardDiff.partials(x)
Base.:*(r::AbstractMatrix, u::RotMatLie{T}) where T = SMatrix{3, 3, T, 9}(T(r[1,1], du(u.z)*r[1,2]-du(u.y)*r[1,3]), T(r[2,1], du(u.z)*r[2,2]-du(u.y)*r[2,3]), T(r[3,1], du(u.z)*r[3,2]-du(u.y)*r[3,3]),
T(r[1,2], du(u.x)*r[1,3]-du(u.z)*r[1,1]), T(r[2,2], du(u.x)*r[2,3]-du(u.z)*r[2,1]), T(r[3,2], du(u.x)*r[3,3]-du(u.z)*r[3,1]),
T(r[1,3], du(u.y)*r[1,1]-du(u.x)*r[1,2]), T(r[2,3], du(u.y)*r[2,1]-du(u.x)*r[2,2]), T(r[3,3], du(u.y)*r[3,1]-du(u.x)*r[3,2]))
Base.:*(u::RotMatLie{T}, r::AbstractMatrix) where T = SMatrix{3, 3, T, 9}(T(r[1,1], du(u.y)*r[3,1]-du(u.z)*r[2,1]), T(r[2,1], du(u.z)*r[1,1]-du(u.x)*r[3,1]), T(r[3,1], du(u.x)*r[2,1]-du(u.y)*r[1,1]),
T(r[1,2], du(u.y)*r[3,2]-du(u.z)*r[2,2]), T(r[2,2], du(u.z)*r[1,2]-du(u.x)*r[3,2]), T(r[3,2], du(u.x)*r[2,2]-du(u.y)*r[1,2]),
T(r[1,3], du(u.y)*r[3,3]-du(u.z)*r[2,3]), T(r[2,3], du(u.z)*r[1,3]-du(u.x)*r[3,3]), T(r[3,3], du(u.x)*r[2,3]-du(u.y)*r[1,3]))
162 changes: 0 additions & 162 deletions src/marginalize.jl

This file was deleted.

Loading

1 comment on commit 4a372d6

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/94750

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.0.0 -m "<description of version>" 4a372d66dfa021544e9a0b441e19b9c9669c4422
git push origin v4.0.0

Please sign in to comment.