Repository: QuantEcon/QuantEcon.py (python)

Issue:
Update badges on README.md
- [x] `build` badge: Should point to [conda-build](https://github.com/QuantEcon/QuantEcon.py/actions/workflows/ci.yml?query=workflow%3Abuild)?
- [x] Remove `lgtm` badges: Invalid now.
- [ ] `docs`: Would it be helpful to have `stable` and `latest` badges?

Pull request:
Fix: Readme to have stable vs latest py badges 
This pr adds the stable vs latest badges for python to help the user to understand the project maturity and python compatibility 

Fixes #672 

Changes : 
![image](https://github.com/user-attachments/assets/adde8a62-b31d-4a41-97c5-6408493cb427)
previous 
![image](https://github.com/user-attachments/assets/7dc01458-28ef-4cba-b1dc-4636dc6a8a49)
After 

Patch:
diff --git a/README.md b/README.md
index a1530e5..e48d706 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,8 @@ A high performance, open source Python code library for economics
 [![Build Status](https://github.com/QuantEcon/QuantEcon.py/actions/workflows/ci.yml/badge.svg)](https://github.com/QuantEcon/QuantEcon.py/actions?query=workflow%3Abuild)
 [![Coverage Status](https://coveralls.io/repos/QuantEcon/QuantEcon.py/badge.svg)](https://coveralls.io/r/QuantEcon/QuantEcon.py)
 [![Documentation Status](https://readthedocs.org/projects/quanteconpy/badge/?version=latest)](https://quanteconpy.readthedocs.io/en/latest/?badge=latest)
+[![PyPI Version](https://img.shields.io/pypi/v/quantecon.svg)](https://pypi.org/project/quantecon/)
+[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/quantecon.svg)](https://pypi.org/project/quantecon/)
 
 ## Installation
 
diff --git a/quantecon/_matrix_eqn.py b/quantecon/_matrix_eqn.py
index 09466e2..e2c6174 100644
--- a/quantecon/_matrix_eqn.py
+++ b/quantecon/_matrix_eqn.py
@@ -150,10 +150,6 @@ def solve_discrete_riccati(A, B, Q, R, N=None, tolerance=1e-10, max_iter=500,
         msg = "Check your method input. Should be {} or {}".format(*methods)
         raise ValueError(msg)
 
-    # == Set up == #
-    error = tolerance + 1
-    fail_msg = "Convergence failed after {} iterations."
-
     # == Make sure that all array_likes are np arrays, two-dimensional == #
     A, B, Q, R = np.atleast_2d(A, B, Q, R)
     n, k = R.shape[0], Q.shape[0]
@@ -164,10 +160,15 @@ def solve_discrete_riccati(A, B, Q, R, N=None, tolerance=1e-10, max_iter=500,
         N = np.atleast_2d(N)
 
     if method == 'qz':
-        X = sp_solve_discrete_are(A, B, Q, R, s=N.T)
+        X = sp_solve_discrete_are(A, B, Q, R, e=I, s=N.T)
         return X
 
     # if method == 'doubling'
+
+    # == Set up == #
+    error = tolerance + 1
+    fail_msg = "Convergence failed after {} iterations."
+
     # == Choose optimal value of gamma in R_hat = R + gamma B'B == #
     current_min = np.inf
     candidates = (0.01, 0.1, 0.25, 0.5, 1.0, 2.0, 10.0, 100.0, 10e5)
diff --git a/quantecon/optimize/lcp_lemke.py b/quantecon/optimize/lcp_lemke.py
index 2ee54f9..b0464ec 100644
--- a/quantecon/optimize/lcp_lemke.py
+++ b/quantecon/optimize/lcp_lemke.py
@@ -150,7 +150,7 @@ def lcp_lemke(M, q, d=None, max_iter=10**6, piv_options=PivOptions(),
         ratio = q[i] / d[i]
         if ratio <= ratio_min + piv_options.tol_ratio_diff:
             pivrow = i
-            ratio = ratio_min
+            ratio_min = ratio
 
     _pivoting(tableau, pivcol, pivrow)
     basis[pivrow], pivcol = pivcol, pivrow + n


Test patch:
diff --git a/quantecon/optimize/tests/test_lcp_lemke.py b/quantecon/optimize/tests/test_lcp_lemke.py
index 15d2707..457b252 100644
--- a/quantecon/optimize/tests/test_lcp_lemke.py
+++ b/quantecon/optimize/tests/test_lcp_lemke.py
@@ -107,3 +107,13 @@ class TestLCPLemke:
 
         res = lcp_lemke(M, q)
         _assert_success(res, M, q)
+
+    def test_bug_768(self):
+        n = 10
+        seed = 0
+        rng = np.random.RandomState(seed)
+        A = rng.standard_normal((n, n))
+        M = A.T @ A + np.eye(n)
+        q = rng.standard_normal(n)
+        res = lcp_lemke(M, q)
+        _assert_success(res, M, q)