'Parameters
n : integer
Number of variates to generate
shape : iterable
Shape of the variates to generate
dim : int
Dimension of the scale matrix
df : int
Degrees of freedom
C : ndarray
Cholesky factorization of the scale matrix, lower triagular.
%(_doc_random_state)s
Notes
As this function does no argument checking, it should not be
called directly; use \'rvs\' instead.'

def _rvs(self, n, shape, dim, df, C, random_state):

    random_state = self._get_random_state(random_state)
    A = super(invwishart_gen, self)._standard_rvs(n, shape, dim, df, random_state)
    eye = np.eye(dim)
    trtrs = get_lapack_funcs('trtrs', (A,))
    for index in np.ndindex(A.shape[:(-2)]):
        CA = np.dot(C, A[index])
        if (dim > 1):
            (CA, info) = trtrs(CA, eye, lower=True)
            if (info > 0):
                raise LinAlgError('Singular    matrix.')
            if (info < 0):
                raise ValueError(('Illegal    value    in    %d-th    argument    of    internal    trtrs' % (- info)))
        else:
            CA = (1.0 / CA)
        A[index] = np.dot(CA.T, CA)
    return A
