Skip to content

New model

Dániel Varjas requested to merge new_model into master

Implemented new functionality in Model:

  • Implement __matmul__ (@) and change the behaviour of * to be consistent with the way this works in arrays.
  • Support of sparse matrices and LinearOperator as values.
  • Consistent support of scalar valued Models.
  • Add keep to only keep track of certain symbolic coefficients.
  • More options and more transparent initialization, allow string keys which are automatically symmpified by default.
  • Several new utility functions, such as trace, reshape, etc.

Optimizations:

  • Remove unnecessary deep copying, which was slow.
  • Optimize the implementation of arithmetic operations to minimize number of loops and function calls.
  • Fast initialization by making restructuring optional when initialized with a dict.
  • Clean up the code of BlochModel to utilize improvements in Model.
  • Update symmetry finder to work with sparse models.

Backward compatibility

  • Changing the behaviour of * breaks backward compatibility, but aside from a few uses in the qsymm code base (fixed), we do not use it in the examples and not aware of anyone using this functionality.
  • Deprecate initializing empty Model without providing shape and dtype.
  • Stop supporting a sequence of ints as momenta
  • Certain other ways to initialize Model don't work anymore, some tests were changed accordingly. This again is unlikely to break any existing code.
  • Some tests in kwant.qsymm break because of changed internal format.
Edited by Dániel Varjas

Merge request reports