0
Z odpowiedzią

SVD behavior in mp different from Matlab when applied to negative scalar

Denis Tkachenko 8 lat temu zaktualizowano 8 lat temu 2

I have the following question:


In one of my examples I need to compute the Singular Value Decomposition (SVD) of a negative scalar, specifically -0.7276.


In double precision, Matlab returns:

>> [U S V]=svd(-0.7276)

U = -1
S = 0.7276
V =1


In MP, I obtain:


s=mp('-0,7276');


>> [U,S,V]=svd(s)


U = 1
S = -0.7276
V = 1


The definition of SVD states that the matrix S should have nonnegative diagonal entries. In the above example, the first two elements seem to be multiplied by -1 compared to Matlab output. While the product doesn't change, the unexpected negative sign of the singular value causes problems in subsequent code.


Is this a bug or is there an option to make it return the same output as Matlab's svd?


The 4.2.3.11967 release of the toolbox was used.

Thank you,

Denis

Odpowiedź

Odpowiedź
Z odpowiedzią

Dear Denis,

Thank you very much for the report!


Indeed, this is bug and it has been fixed in latest build.

Please download updated version: http://goo.gl/pMXV3


Thank you,

Pavel.

Odpowiedź
Z odpowiedzią

Dear Denis,

Thank you very much for the report!


Indeed, this is bug and it has been fixed in latest build.

Please download updated version: http://goo.gl/pMXV3


Thank you,

Pavel.

Dear Pavel,


Thank you very much for your very prompt reply! The problem is fixed with the new build.


Best,

Denis