'Gives the (sub/super)gradient of the atom w.r.t. each argument.
Matrix expressions are vectorized, so the gradient is a matrix.
Args:
values: A list of numeric values for the arguments.
Returns:
A list of SciPy CSC sparse matrices or None.'

def _grad(self, values):

    X = np.matrix(values[0])
    P = np.matrix(values[1])
    try:
        P_inv = LA.inv(P)
    except LA.LinAlgError:
        return [None, None]
    else:
        DX = np.dot((P_inv + np.transpose(P_inv)), X)
        DX = DX.T.ravel(order='F')
        DX = sp.csc_matrix(DX).T
        DP = P_inv.dot(X)
        DP = DP.dot(X.T)
        DP = DP.dot(P_inv)
        DP = (- DP.T)
        DP = sp.csc_matrix(DP.T.ravel(order='F')).T
        return [DX, DP]
