Git Product home page Git Product logo

Comments (6)

kouchy avatar kouchy commented on May 18, 2024

Hi @flori-uni,

In MIPP we chose that horizontal operations return a scalar (hadd, hmul, etc.). I'm not sure I want to modify this default behavior documented here: https://github.com/aff3ct/MIPP#reductions-horizontal-functions-.
But if you need a vector instead of a scalar, you can write mipp::Reduction<T,mipp::add<T>>::apply(v); (apply instead of sapply) in your code.

from mipp.

fritterhoff avatar fritterhoff commented on May 18, 2024

Well I plan to use the functionality for calculation on complex numbers. In detail for calculating real²+imaginary².

The real and imaginary part are in the same memory stored alternating. So I have re,im,re,im...

Maybe I'll implement some separated methods for my use-case. Later I probably need also the real and imaginary parts separate...

from mipp.

fritterhoff avatar fritterhoff commented on May 18, 2024

mipp::Reduction<T,mipp::add>::apply(v); actually does not result in the right data. I think i need to implement it on my own 😢

from mipp.

kouchy avatar kouchy commented on May 18, 2024

I'm not sure to understand, what is the result you expect? Could you give me an example?

from mipp.

fritterhoff avatar fritterhoff commented on May 18, 2024

Using AVX2 I'm able to do the following:

for (auto idx = 0u; idx < max - 3; idx += 4)
{
         auto item = _mm256_load_ps(&data[idx]);
         item = _mm256_mul_ps(item, item );
         auto mag = _mm256_hadd_ps(item, zeros);
         sum = _mm256_add_ps(sum, _mm256_sqrt_ps(mag));
}
auto totalSum = sum[0] + sum[1] + sum[4] + sum[5];       

So it calculates sqrt(x*x+y*y) for each complex pair. Afterwards i can calculate the mean of the sum and some other stuff

from mipp.

fritterhoff avatar fritterhoff commented on May 18, 2024
    [1,  2,  3,  4,  5,  6,  7,  8]
*   [1,  2,  3,  4,  5,  6,  7,  8]
    [1,  4,  9, 16, 25, 36, 49, 64]
hadd[5,  0, 25,  0, 61,  0,113, 0,]
sqrt[.............................]

from mipp.

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.