[Numpy-discussion] determinant of a scalar not handled
Alan G Isaac
aisaac at american.edu
Tue Jul 27 10:01:33 EDT 2010
> On Mon, Jul 26, 2010 at 10:05 PM, Alan G Isaac<aisaac at american.edu> wrote:
>> But I am still confused about the use case.
>> What is the scalar- (or 1d-array-) returning procedure
>> invoked before taking the determinant?
On 7/27/2010 8:51 AM, Skipper Seabold wrote:
> Recently I ran into this trying to make the log-likelihood of a
> multivariate and univariate autoregressive process use the same
> function. One has log(sigma_scalar) and one calls for
> logdet(Sigma_matrix). I also ran in to again yesterday working on the
> Kalman filter, depending on the process being modeled and how the user
> writes a function if the needed coefficient arrays depend on
> parameters. To be more general, I have to put in atleast_2d, even
> though these checks are really in slogdet.
OK, I see. Two comments, without going over the code.
1. It seems the problem really arises earlier, when
computing the residuals. I suppose the single equation code
produces a 1d array, while the multi-equation code must
produce a 2d array of residuals. This seems
like the better place to fix things if you want
general handling: make sure the residuals are always 2d.
2. If you don't want to do this, you could always
branch on the LinAlgError.
Cheers,
Alan Isaac
More information about the NumPy-Discussion
mailing list