Skip to content

Commit 17da2d2

Browse files
authored
Type specifications for GradientGrassmann (#209)
1 parent a868108 commit 17da2d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/algorithms/groundstate/gradient_grassmann.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ with a preconditioner to induce the metric from the Hilbert space inner product.
77
88
## Fields
99
- `method::OptimKit.OptimizationAlgorithm`: algorithm to perform the gradient search
10-
- `finalize!::Function`: user-supplied function which is applied after each iteration, with
10+
- `finalize!`: user-supplied callable which is applied after each iteration, with
1111
signature `finalize!(x::GrassmannMPS.ManifoldPoint, f, g, numiter) -> x, f, g`
1212
1313
---
@@ -23,9 +23,9 @@ with a preconditioner to induce the metric from the Hilbert space inner product.
2323
- `maxiter::Int`: maximum amount of iterations
2424
- `verbosity::Int`: level of information display
2525
"""
26-
struct GradientGrassmann <: Algorithm
27-
method::OptimKit.OptimizationAlgorithm
28-
finalize!::Function
26+
struct GradientGrassmann{O<:OptimKit.OptimizationAlgorithm,F} <: Algorithm
27+
method::O
28+
finalize!::F
2929

3030
function GradientGrassmann(; method=ConjugateGradient, (finalize!)=OptimKit._finalize!,
3131
tol=Defaults.tol, maxiter=Defaults.maxiter, verbosity=2)
@@ -39,7 +39,7 @@ struct GradientGrassmann <: Algorithm
3939
msg = "method should be either an instance or a subtype of `OptimKit.OptimizationAlgorithm`."
4040
throw(ArgumentError(msg))
4141
end
42-
return new(m, finalize!)
42+
return new{typeof(m),typeof(finalize!)}(m, finalize!)
4343
end
4444
end
4545

0 commit comments

Comments
 (0)