mardi 25 février 2020

How to create BOOST_COMPUTE_FUNCTION from class member function?

my object-class is as follows:

class TTT{
public:
    int value;
    double start(std::vector<unsigned int> input){
        double out=0;
        for (auto i:input){
            out+=this->factorial(i);
        }
        return out+this->value;
    }
private:
    double factorial(unsigned int i)
    {
        if(i <= 1)
        {
            return 1;
        }
        return i * factorial(i - 1);
    }
};

when I try to create it like this:

    BOOST_COMPUTE_FUNCTION(double, test,
                           (TTT values0,std::vector<unsigned int> values1),
                           {
                               return values0.start(values1);
                           });

I got errors,because I use two classes TTT and std::vector:

sp, how should I use boost::compute to improve CPU object-class computation ?

Aucun commentaire:

Enregistrer un commentaire