jeanluct/rodent

Use copy method instead of for loop

Opened this issue · 2 comments

I am working on providing my own vector type to rodent and I stumbled over a few places in base.hpp where the content of one container is copy to another by

for (int i = 0; i < n; ++i) y[i] = y1[i];

Would it be possible to provide an explicit copy method y.copy(y1)?
This would be beneficial for using sparse-matrices or in my case for large systems that would benefit from parallelized operations.

There is a copy method defined in the traits.hpp file. It might be something different though: when I was dealing with the old blitz library there were issues with whether "=" created a new object or just passed a reference. But anyways, I think a copy method could be added as part of the traits. In fact all of rodent should probably be updated to be more STL-like.

I was wondering should my container implement the traits directly? Currently I just defined what throw an error on compilation.