'Parameters
x : ndarray
Points at which to evaluate the log of the probability
density function.
dim : int
Dimension of the scale matrix
df : int
Degrees of freedom
scale : ndarray
Scale matrix
log_det_scale : float
Logarithm of the determinant of the scale matrix
Notes
As this function does no argument checking, it should not be
called directly; use \'logpdf\' instead.'

def _logpdf(self, x, dim, df, scale, log_det_scale):

    log_det_x = np.zeros(x.shape[(-1)])
    x_inv = np.copy(x).T
    if (dim > 1):
        _cho_inv_batch(x_inv)
    else:
        x_inv = (1.0 / x_inv)
    tr_scale_x_inv = np.zeros(x.shape[(-1)])
    for i in range(x.shape[(-1)]):
        (C, lower) = scipy.linalg.cho_factor(x[:, :, i], lower=True)
        log_det_x[i] = (2 * np.sum(np.log(C.diagonal())))
        tr_scale_x_inv[i] = np.dot(scale, x_inv[i]).trace()
    out = (((((0.5 * df) * log_det_scale) - (0.5 * tr_scale_x_inv)) - ((((0.5 * df) * dim) * _LOG_2) + ((0.5 * ((df + dim) + 1)) * log_det_x))) - multigammaln((0.5 * df), dim))
    return out
