
Boost : 
Subject: Re: [boost] [math] Efficient polynomial multiplication
From: Lakshay Garg (lakshayg373_at_[hidden])
Date: 20170717 19:01:44
>
> I would guess memory allocation: if you're multiplying into already
> allocated arrays and don't have to dynamically allocate memory for the
> result of the multiplication, then that should be a lot quicker.
>
â€‹No, I do not preallocate arrays. Here is the code for O(N^2) algorithm
I'm using:
double * g(double * p, double * q, size_t len) {
double * out = new double[2*len];
clear(out, 2*len); // calls memset
for (int i=0; i<len; ++i)
for (int j=0; j<len; ++j)
out[i+j] += p[i] * q[j];
return out;
}â€‹
I can't remember if the polynomial class operators are moveoptimised
> either (they should be).
>
â€‹I don't think they are move optimized. All the function take lvalue
referencesâ€‹. Neither does this have a move constructor. I guess this class
needs a lot of work.
 Lakshay
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk