From 76481bd033a84584a5812b50dc7542806be7884e Mon Sep 17 00:00:00 2001 From: Joseph Weston <joseph@weston.cloud> Date: Tue, 26 Nov 2019 11:10:10 +0100 Subject: [PATCH] add whatsnew entry --- doc/source/pre/whatsnew/1.5.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/source/pre/whatsnew/1.5.rst b/doc/source/pre/whatsnew/1.5.rst index d355d823..2e89d747 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 ------------------------------------------------------ -- GitLab