framework icon indicating copy to clipboard operation
framework copied to clipboard

Bug with Elementwise.Pow

Open MarcosRodMun opened this issue 7 years ago • 1 comments

What would you like to submit? (put an 'x' inside the bracket that applies)

  • [ ] question
  • [x] bug report
  • [ ] feature request

Issue description

double[] v = new double[] {1, -2, 3, 4}; ElementWise.Pow(v,1); //returns {1 2 3 4}

There seems to be an unnecessary "Math.Abs()" in the Pow operation.

MarcosRodMun avatar Apr 01 '18 09:04 MarcosRodMun

Agree, and if you try and use ElementWise.SignedPow instead this is what happens.

double[] v = new double[] {1, -2, 3, 4}; ElementWise.SignedPow(v,1); //returns {1 -2 3 4}

Which is correct but this happens

double[] v = new double[] {1, -2, 3, 4}; ElementWise.SignedPow(v,2); //returns {1 -4 9 16}

So currently there is no element-wise power function that works without knowing the answer for each element in the matrix/vector. The only workaround is to manually cycle through each element of the matrix/vector and perform the element-wise power operation yourself.

gwguerrilla avatar Aug 27 '20 13:08 gwguerrilla