Giter VIP home page Giter VIP logo

impuritymodel's Issues

Suggestion: Use the int representation of a product state in the calculations instead of the bytes/bitarray representation

At the moment use bitarray from the bitarray package to represent a product state.

Store Hamiltonian matrix elements in sparse format in a dict.
The product states are dict-keys so also need an immutable representation of a product state.
Get this by using bitarray's .tobytes() method.

Instead of using bitarray one could use one Python built-in integer to represent a product state.
It is immutable so no need to convert between two representations during calculations.
It should be roughly as quick to change a state (removing or adding an electron) using the integer representation as using bitarray, since bit-shifts are used modify the integer representation (since #47).

If use the integer representation in the calculations could remove bitarray as a representation of a product state.

Magnetic field issue

There is a small bug in get_spectrum and get_spectrum_using_CF. The magnetic field hx is overwritten by hy in the following lines:

    hHfieldOperator[(((l, 1, m), 'c'), ((l, 0, m), 'a'))] = hx*1/2.
    hHfieldOperator[(((l, 0, m), 'c'), ((l, 1, m), 'a'))] = hx*1/2.
    hHfieldOperator[(((l, 1, m), 'c'), ((l, 0, m), 'a'))] = -hy*1/2.*1j
    hHfieldOperator[(((l, 0, m), 'c'), ((l, 1, m), 'a'))] = hy*1/2.*1j

/Patrik

Make Lanczos algorithm more robust

The Lanczos algorithm may suffer from numerical instability, see discussion in e.g. https://en.wikipedia.org/wiki/Lanczos_algorithm.
The generous unit-test tolerances indicate numerical round-off errors are indeed present (compared the same code on Mac OS X and Ubuntu).
Until now, the errors I have seen have been smaller than the physics of interest.
But it is good to be aware of this numerical instability issue, in particular if very subtle features are of interest.

In https://en.wikipedia.org/wiki/Lanczos_algorithm, a few ideas and references are provided of how to improve the numerical stability of the Lanczos algorithm, that might be relevant for this repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.