Giter VIP home page Giter VIP logo

Comments (2)

ichristen avatar ichristen commented on June 12, 2024

Hi @LeoKonzett , thanks for this great question.

  1. The np.bitwise_and() performs the action of np.mod() in the case when self.phase_scaling == 1 (consider the case of a 10- or 7- bit SLM). This is super fast compared with np.mod(). However, you're completely right that this call is unnecessary in the case where you have an 8-bit or 16-bit SLM, as the type casting already performs the and. I have added a check to not do this in those cases (6ece4bb).
  2. The intent was to avoid np.around() overhead. We could accomplish the same thing by adding .5 before type-casting, but I'm uncertain whether it's worth the overhead for this fractional change. I have added documentation (6ece4bb) specifying the floor()ed behavior.
  3. In testing, I wasn't able to find a case where unsafe casting didn't behave like floor(), but if you can find one then I agree that a better solution is needed. I agree that the ironic "unsafe" flag correctly implies lack of safety, but I think it's deterministic in our case. Note that this line makes sure that all numbers are negative. The example that you gave is desired behavior, because this is the effect of mod by 256.

To answer your last question, yes the reasoning is speed. While something similar to this could be faster (like the ultimate solution for speed: going full-C and writing directly to some integer buffer and never touching floats), this solution was able to maintain both the 60 Hz operation in testing and the user-friendly 2pi float submission that we wanted to have. np.mod() was a main limitation for other implementations. Of course, we welcome any contributions to make the package better. If you have any ideas for how to improve this while still maintaining speed, feel free to discuss or add something! Let me know if you have any comments on the mentioned changes (6ece4bb), we'll probably pull request this within a week.

from slmsuite.

ichristen avatar ichristen commented on June 12, 2024

I'm closing this issue as these changes were pulled under request #24.

Please feel free, @LeoKonzett, to reopen it or to contact us about anything else! Looking forward to see what you do with the package.

from slmsuite.

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.