On Wed, Apr 17, 2013 at 7:08 AM, Mario Mulansky
On Tuesday, April 16, 2013 08:16:57 PM Steven Watanabe wrote:
AMDG
On 04/16/2013 07:20 PM, Mario Mulansky wrote:
Hi,
I wanted to add an elementwise divide operations for ublas matrices using operator /
I don't think that's such a great idea. Using regular operators for elementwise operations is likely to be surprising. i.e. if you can do (A / B) you should be able to do (A * B) as well, and it you be the inverse of A / B. But multiplication is defined for matrices and is *not* an elementwise operation. There is no way to define this that won't surprise someone. There's a good reason why uBlas doesn't provide these operators already and why MATLAB has a separate set of operators for elementwise operations.
uh wait, i dont want to add this operator to ublas. I need it within odeint and it would be part of some ublas_extension.hpp in odeint, it would be merely an implementation detail no user would encounter.
[...] If no user would encounter it, why don't you just define and use a free function elementwise_divide? Why does it have to be named operator/? - Jeff