[SciPy-dev] Best interface for computing the logarithm of the determinant?
Tue Feb 16 15:16:05 CST 2010
On Tue, Feb 16, 2010 at 1:01 PM, Warren Weckesser
> Nathaniel Smith wrote:
>> So when you have a matrix whose determinant you want, it's often wise
>> to compute the logarithm of the determinant instead of the determinant
>> itself, because determinants involve lots and lots of multiplications
>> and the result might otherwise underflow/overflow. Therefore, in
>> scikits.sparse, I'd like to provide an API for doing this (and this is
>> well-supported by the underlying libraries).
>> But the problem is that for a general matrix, the determinant may be
>> zero or negative.
> For a general matrix, the determinant may be complex. Or are you only
> considering real matrices?
Sorry, yes. For a complex matrix, obviously you expect a complex
determinant and there is no problem. But it may be confusing for
people to get a complex number out when they are computing the (real)
determinant of a real matrix; for instance, np.log on real-value
inputs never returns a complex number, even if this means it must
return NaN. Or perhaps this would be just fine, that's why it's one of
the options I mentioned :-).
It is a good point though that whatever API we pick should not be too
annoying for people with complex matrices, since we want to use the
same API for both real and complex.
More information about the SciPy-Dev