="o">+</span><span class="mi">1</span><span class="p">,</span><span class="n">dtype</span><span class="o">=</span><span class="n">dtype_real</span><span class="p">)</span>
<span class="c1"># compute initial values for obsrvables</span>
<span class="n">E_density</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">=</span><span class="n">H_ave</span><span class="o">.</span><span class="n">expt_value</span><span class="p">(</span><span class="n">psi_i</span><span class="p">)</span><span class="o">.</span><span class="n">real</span><span class="o">/</span><span class="n">L</span>
<span class="n">Sent_density</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">=</span><span class="n">basis</span><span class="o">.</span><span class="n">ent_entropy</span><span class="p">(</span><span class="n">psi_i</span><span class="p">,</span><span class="n">sub_sys_A</span><span class="o">=</span><span class="nb">range</span><span class="p">(</span><span class="n">L</span><span class="o">//</span><span class="mi">2</span><span class="p">),</span><span class="n">density</span><span class="o">=</span><span class="kc">True</span><span class="p">)[</span><span class="s1">&#39;Sent_A&#39;</span><span class="p">]</span>
<span class="c1">#</span>
<span class="c1">##### compute the time evolution using expm_multple_parallel</span>
<span class="c1">#</span>
<span class="c1"># construct piece-wise constant unitaries</span>
<span class="n">expH0</span> <span class="o">=</span> <span class="n">expm_multiply_parallel</span><span class="p">(</span><span class="n">H0</span><span class="o">.</span><span class="n">tocsr</span><span class="p">(),</span><span class="n">a</span><span class="o">=-</span><span class="mi">1</span><span class="n">j</span><span class="o">*</span><span class="mf">0.5</span><span class="o">*</span><span class="n">T</span><span class="p">,</span><span class="n">dtype</span><span class="o">=</span><span class="n">dtype_cmplx</span><span class="p">)</span>
<span class="n">expH1</span> <span class="o">=</span> <span class="n">expm_multiply_parallel</span><span class="p">(</span><span class="n">H1</span><span class="o">.</span><span class="n">tocsr</span><span class="p">(),</span><span class="n">a</span><span class="o">=-</span><span class="mi">1</span><span class="n">j</span><span class="o">*</span><span class="mf">0.5</span><span class="o">*</span><span class="n">T</span><span class="p">,</span><span class="n">dtype</span><span class="o">=</span><span class="n">dtype_cmplx</span><span class="p">)</span> 
<span class="c1">#</span>
<span class="c1"># auxiliary array for memory efficiency</span>
<span class="n">psi</span><span class="o">=</span><span class="n">psi_i</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">complex128</span><span class="p">)</span>
<span class="n">work_array</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">2</span><span class="o">*</span><span class="nb">len</span><span class="p">(</span><span class="n">psi</span><span class="p">),),</span> <span class="n">dtype</span><span class="o">=</span><span class="n">psi</span><span class="o">.</span><span class="n">dtype</span><span class="p">)</span> <span class="c1"># twice as long because complex-valued</span>
<span class="c1">#</span>
<span class="c1"># loop ober the time steps</span>
<span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">N_steps</span><span class="p">):</span>
	<span class="c1">#</span>
	<span class="c1"># apply to state psi and update psi in-place</span>
	<span class="n">expH0</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">psi</span><span class="p">,</span><span class="n">work_array</span><span class="o">=</span><span class="n">work_array</span><span class="p">,</span><span class="n">overwrite_v</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> 
	<span class="n">expH1</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">psi</span><span class="p">,</span><span class="n">work_array</span><span class="o">=</span><span class="n">work_array</span><span class="p">,</span><span class="n">overwrite_v</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
	<span class="c1"># measure &#39;oservables&#39;</span>
	<span class="n">E_density</span><span class="p">[</span><span class="n">j</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span><span class="o">=</span><span class="n">H_ave</span><span class="o">.</span><span class="n">expt_value</span><span class="p">(</span><span class="n">psi</span><span class="p">)</span><span class="o">.</span><span class="n">real</span><span class="o">/</span><span class="n">L</span>
	<span class="n">Sent_density</span><span class="p">[</span><span class="n">j</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span><span class="o">=</span><span class="n">basis</span><span class="o">.</span><span class="n">ent_entropy</span><span class="p">(</span><span class="n">psi</span><span class="p">,</span><span class="n">sub_sys_A</span><span class="o">=</span><span class="nb">range</span><span class="p">(</span><span class