nix icon indicating copy to clipboard operation
nix copied to clipboard

Handle polynomial when reading data in DataArray

Open gicmo opened this issue 10 years ago • 7 comments

When reading data and a polynomial is defined in the DataArray we have to apply it.

gicmo avatar Feb 26 '14 13:02 gicmo

Related to this: as far as I see the "DataArray::expansionOrigin" & "DataArray::polynomCoefficients" re just getting & setting the values without them being used by e.g. applyPolynomial. Should this not yet be changed? Also: would it not be better to use boost::math::tools::evaluate_polynomial (as the UnitTest does), since it handles bigger numbers?

balint42 avatar Feb 27 '14 17:02 balint42

Pull-request #378 handles the basic reading part but leaves following things to do:

  • [ ] throw exception when writing data with a (non-invertable?) polynomial set
  • [ ] throw exception when setting a polynomial for unsupported datatypes (string!)
  • [x] handle expansion origin (should be straight forward with #378 applied)
  • [ ] SPEED, i.e. we currently optimisation like e.g. parallelization in place
  • [ ] Check strict-aliasing (cf. comment below )

gicmo avatar Sep 17 '14 18:09 gicmo

Regarding speed: if applyPolynomial would have the following signature:

vector<double> applyPolynomial(std::vector<double> &coefficients, double origin, const &vector<double> input)

we could have alternative implementations of the function depending on the availability of certain extensions e.g. openMP or AVX intrinsic functions or both.

stoewer avatar Sep 17 '14 18:09 stoewer

@stoewer yes. In order to support optimisations that require special memory handling (e.g. OpenCL) we probably have to abstract even more then just applyPolynomial, i.e. the allocation of temporary buffer and such. But, be correct first, be fast afterwards, right? ;-)

gicmo avatar Sep 17 '14 20:09 gicmo

Just as a heads-up: with #378 I will take care of expansionOrigin next.

gicmo avatar Sep 18 '14 08:09 gicmo

OK, thanks a lot.

stoewer avatar Sep 18 '14 13:09 stoewer

Note to self (and others): I am not really 100% comfortable with read_buffer = reinterpret_cast<double *>(data); (introduced by pull-request #378) due to strict aliasing. Before we close this bug, I want to make sure what we are doing is correct.

gicmo avatar Sep 19 '14 15:09 gicmo