lballabio / QuantLib-SWIG

QuantLib wrappers to other languages
Other
338 stars 282 forks source link

Inconsistency between C++ and SWIG for array multiplication #661

Closed eltoder closed 1 month ago

eltoder commented 1 month ago

In QuantLib's C++ API, Array multiplied by Array returns an array with element-wise product. However, in SWIG (used for Python and R), Array multiplied by Array returns dot product instead. It looks like it has been like this for a very long time, so I'm not sure if we can change this, but this is very unfortunate. Standard Python libraries like numpy also use * for element-wise product.

lballabio commented 1 month ago

Ouch.

No, let's fix this. We'll document the change in the release notes.