Giter VIP home page Giter VIP logo

Comments (6)

rkern avatar rkern commented on May 20, 2024

The left operand gets the first shot at implementing the operation. Only if it fails does the right operand attempt with its __radd__ method. Because MultiVector implements the Sequence interface, np.asarray() knows how to convert it to a numpy array via np.asarray(). The numpy scalar types will attempt to convert the other operand to a numpy array via np.asarray(). Since this succeeds, np.float64.__add__() succeeds, and MultiVector.__radd__() does not get a chance to run.

I don't have a good idea offhand how to get around this.

from clifford.

arsenovic avatar arsenovic commented on May 20, 2024

thanks very much for the info.

is it clear to you that the operator change would cause this? the exp() function operating on a MultiVector now fails also, which i suspect is related.

a similar question is raised in this SO post. after looking at their suggestions the __array_priority__ does not work, but __array_wrap__ does. however this hook seems to be after the numpy __add__ has happened...

they also suggest to subclassing ndarray. however, i am not sure that i have the time/ability to make this change to the whole class, or to decide whether it is a good idea.

from clifford.

arsenovic avatar arsenovic commented on May 20, 2024

so if the left hand operator fails, the right operand attempt with its __radd__ method, then would it be possible to make the ufunc 'fail' by doing something in __array_prepare__

from clifford.

arsenovic avatar arsenovic commented on May 20, 2024

arsenovic@bd3bb72 . . . embarrasing

from clifford.

hugohadfield avatar hugohadfield commented on May 20, 2024

@arsenovic is this now fixed or still a problem?

from clifford.

arsenovic avatar arsenovic commented on May 20, 2024

i think we can close

from clifford.

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.