'Solves for MLE estimate of structural parameters
Parameters
override : bool, default False
If True, returns estimates of A and B without checking
order or rank condition
solver : str or None, optional
Solver to be used. The default is \'nm\' (Nelder-Mead). Other
choices are \'bfgs\', \'newton\' (Newton-Raphson), \'cg\'
conjugate, \'ncg\' (non-conjugate gradient), and \'powell\'.
maxiter : int, optional
The maximum number of iterations. Default is 500.
maxfun : int, optional
The maximum number of function evalutions.
Returns
A_solve, B_solve: ML solutions for A, B matrices'

def _solve_AB(self, start_params, maxiter, maxfun, override=False, solver='bfgs'):

    A_mask = self.A_mask
    B_mask = self.B_mask
    A = self.A
    B = self.B
    A_len = len(A[A_mask])
    A[A_mask] = start_params[:A_len]
    B[B_mask] = start_params[A_len:]
    if (override == False):
        J = self._compute_J(A, B)
        self.check_order(J)
        self.check_rank(J)
    else:
        print('Order/rank    conditions    have    not    been    checked')
    retvals = super(SVAR, self).fit(start_params=start_params, method=solver, maxiter=maxiter, maxfun=maxfun, ftol=1e-20, disp=0).params
    A[A_mask] = retvals[:A_len]
    B[B_mask] = retvals[A_len:]
    return (A, B)
