diff --git a/doc/source/pre/whatsnew/1.5.rst b/doc/source/pre/whatsnew/1.5.rst index d355d823ec5a490871a0c03ed2e5cba73231b799..2e89d74791d9afa5739ecf2b32d11ec5216d0722 100644 --- a/doc/source/pre/whatsnew/1.5.rst +++ b/doc/source/pre/whatsnew/1.5.rst @@ -4,8 +4,8 @@ What's new in Kwant 1.5 This article explains the user-visible changes in Kwant 1.5.0. -Value functions may now be vectorized -------------------------------------- +Kwant supports vectorized value functions +----------------------------------------- It is now possible to define value functions that act on whole arrays of sites at a time. :: @@ -36,6 +36,19 @@ order of magnitude speedup when evaluating system Hamiltonians (though this speedup may be masked by other parts of your computation e.g. calculating the scattering matrix). +Similarly, the ``onsite`` passed to an operator may now be vectorized in the same +way, as long as the system passed to the operator is also vectorized: +:: + + def x_onsite(sites): + x, _ = sites.positions().transpose() + return x + + x_position = kwant.operator.Density(syst, x_onsite) + + psi = kwant.wave_function(syst, energy=0.1)(0)[0] + x_position(psi) + Deprecation of leaving 'norbs' unset for site families ------------------------------------------------------