Skip to content

Commit

Permalink
pass max_depth and stop_after to ExactDiagonalizationProblem
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsch committed Nov 29, 2024
1 parent 174bddd commit c490b8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/ExactDiagonalization/exact_diagonalization_problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ See [`BasisSetRepresentation`](@ref) for more information.
sparse matrices and `10^5` for dense matrices.
- `cutoff`: A cutoff value for the basis set representation.
- `filter`: A filter function for the basis set representation.
- `nnzs = 0`: The number of non-zero elements in the basis set representation. Setting a
non-zero value can speed up the computation.
- `max_depth = Inf`: Limit the depth when building the matrix.
- `stop_after = Inf`: Stop building the matrix after this size is reached.
- `nnzs = 0`: A hint for the number of non-zero elements in the basis set representation.
Setting a non-zero value can speed up the computation.
- `col_hint = 0`: A hint for the number of columns in the basis set representation.
- `sort = false`: Whether to sort the basis set representation.
Expand Down
11 changes: 9 additions & 2 deletions src/ExactDiagonalization/init_and_solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ function CommonSolve.init(
nnzs = get(kw, :nnzs, 0)
col_hint = get(kw, :col_hint, 0)
sort = get(kw, :sort, false)
max_depth = get(kw, :max_depth, Inf)
stop_after = get(kw, :stop_after, Inf)

# determine the starting address or vector
v0 = p.v0
Expand All @@ -136,11 +138,16 @@ function CommonSolve.init(
@assert v0 isa Union{FrozenDVec{<:AbstractFockAddress},Nothing}

# create the BasisSetRepresentation
bsr = BasisSetRepresentation(p.hamiltonian, addr_or_vec; sizelim, filter, nnzs, col_hint, sort)
bsr = BasisSetRepresentation(
p.hamiltonian, addr_or_vec;
sizelim, filter, nnzs, col_hint, sort, max_depth, stop_after,
)

# prepare kwargs for the solver
kw = (; kw..., sizelim, cutoff, filter, nnzs, col_hint, sort)
kw_nt = delete(kw, (:sizelim, :cutoff, :filter, :nnzs, :col_hint, :sort))
kw_nt = delete(
kw, (:sizelim, :cutoff, :filter, :nnzs, :col_hint, :sort, :max_depth, :stop_after)
)

return MatrixEDSolver(algorithm, p, bsr, v0, kw_nt)
end

0 comments on commit c490b8f

Please sign in to comment.