GithubHelp home page GithubHelp logo

Comments (5)

fdmalone avatar fdmalone commented on July 24, 2024

What do you mean work with numbers exactly? @kevinsung implemented this so might have some more insights on the design decisions.

from openfermion.

kevinsung avatar kevinsung commented on July 24, 2024

I would like to understand if there is a specific rationale behind the absence of implementations for identity() and operations like add with numbers.

As far as I remember, I don't think there was a specific rationale. Adding those methods simply wasn't deemed important enough at the time, but I think they would be a welcome addition.

from openfermion.

snow0369 avatar snow0369 commented on July 24, 2024

What do you mean work with numbers exactly? @kevinsung implemented this so might have some more insights on the design decisions.

Sorry for the lack of the detail. I meant work with numbers as taking numbers (such as int, float and complex) as an input to the operations like __add__ and __sub__.

As far as I remember, I don't think there was a specific rationale. Adding those methods simply wasn't deemed important enough at the time, but I think they would be a welcome addition.

Then, I am happy to be assigned for that.

While I work on it, I think there is a bug in __isub__(here):

    def __isub__(self, other):
        if not isinstance(other, type(self)):
            return NotImplemented

        for term, coefficient in other.terms.items():
            if term in self.terms:
                self.terms[term] -= coefficient
            else:
                self.terms[term] = coefficient  # <- Here, shouldn't it be -coefficient?

        return self

Thank you.

from openfermion.

snow0369 avatar snow0369 commented on July 24, 2024

@fdmalone Hi, I want to gently remind you about the pull request. I fixed a bug in the subtraction between two Majorana operators, and updated operation between Majorana operator and numbers. Thank you for your attention.

from openfermion.

fdmalone avatar fdmalone commented on July 24, 2024

my bad. Thanks for the contribution.

from openfermion.

Related Issues (20)

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.