Skip to content

Commit 32626ef

Browse files
committed
Split applyexp function to allow passing custom problem
1 parent b47ed54 commit 32626ef

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/solvers/applyexp.jl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ function sweep_printer(
8282
end
8383

8484
function applyexp(
85-
operator::AbstractITensorNetwork,
86-
exponents,
87-
init_state::AbstractITensorNetwork;
85+
init_prob::AbstractProblem,
86+
exponents;
8887
extract_kwargs=(;),
8988
update_kwargs=(;),
9089
insert_kwargs=(;),
@@ -93,11 +92,6 @@ function applyexp(
9392
order=4,
9493
kws...,
9594
)
96-
init_prob = ApplyExpProblem(;
97-
state=align_indices(init_state),
98-
operator=ProjTTN(align_indices(operator)),
99-
current_exponent=first(exponents),
100-
)
10195
exponent_steps = diff([zero(eltype(exponents)); exponents])
10296
sweep_kws = (; outputlevel, extract_kwargs, insert_kwargs, nsites, order, update_kwargs)
10397
kws_array = [(; sweep_kws..., time_step=t) for t in exponent_steps]
@@ -106,6 +100,15 @@ function applyexp(
106100
return state(converged_prob)
107101
end
108102

103+
function applyexp(operator, exponents, init_state; kws...)
104+
init_prob = ApplyExpProblem(;
105+
state=align_indices(init_state),
106+
operator=ProjTTN(align_indices(operator)),
107+
current_exponent=first(exponents),
108+
)
109+
return applyexp(init_prob, exponents; kws...)
110+
end
111+
109112
process_real_times(z) = iszero(abs(z)) ? 0.0 : round(-imag(z); digits=10)
110113

111114
function time_evolve(

0 commit comments

Comments
 (0)