Giter Club home page Giter Club logo

Comments (6)

jtlap avatar jtlap commented on August 25, 2024

As a matter of fact, perhaps it will be better to change the function return type policy:

sqrt(x) will for instance return a complex type by default, even if x is scalar floating, but
sqrt(x,real) will return nan if x is not real and greater or equal to zero.

This imply to change the behaviour of all "inverse" functions that are not defined on the full real
range:

log, inverse trigonometry functions inverse hyperbolic functions except asinh.
also the function having no meaning for complex (non real) entries can have a Nan or assert behaviour
on complex for which is_real is false.

I think that will make easier the real/complex mix. Is there any objection or consequences I
have missed ?

from boost.simd.

jfalcou avatar jfalcou commented on August 25, 2024

I am against this for three reasons:

  • monumental breaking change in existing code
  • unexpected behavior w/r to regular C++ functions
  • performances penalty in clear violation of C++ philosophy of 'dont pay for what you dont use'

from boost.simd.

jtlap avatar jtlap commented on August 25, 2024
  • monumental breaking change in existing code

    Not so clear as boost simd does not exists yet and the change will be only ...,real_)
    inside the library

  • unexpected behavior w/r to regular C++ functions

No : regular will be ,real

  • performances penalty in clear violation of C++ philosophy of 'dont
    pay for what you dont use'

no penalty with ,real. It is the same philosophy for instance as sqrt
and realsqrt in matlab
More using unduly sqrt or other is immediately seen at compile time if
the result is put in a non complex container


Reply to this email directly or view it on GitHub
#9 (comment).

from boost.simd.

jfalcou avatar jfalcou commented on August 25, 2024

boost.SIMD exists, people are usign the NT2 internal version already. Not sure they will liek the change. Again, this change is detrimental to the code alreay written, make surprising interface and bring nothing to the table.

complex computations are not the norm and has not to be. people expect sqrt(3.f) to return a real not a complex. Documentign that sqrt(-1.) is NaN is enough. Tags are here for specify behavior of the function not tied to types. return a complex is to be determined by type, so no tags are required.

I suggest we stick to the current model. If you want i as a result of sqrt(-1), use the complex version taking -1 as a complex. No other libraries does it the other way around, nor does the standard nor does C. I woudl prefer having sqrt(-1, complex_) to get rid of dry types than the other way around.

from boost.simd.

jtlap avatar jtlap commented on August 25, 2024

Ok I agree

from boost.simd.

jfalcou avatar jfalcou commented on August 25, 2024

The global issue is to support struct and tuple inside pack while maintaining integrity and option to interleave/deinterleave on the fly. Complex is just the diretc use case.

Issue renamed accordingly

from boost.simd.

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.