Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -234,6 +234,24 @@ def is_semipositive_definite(matrix):
|
|
| 234 |
|
| 235 |
# Check if all eigenvalues are non-negative
|
| 236 |
return all(val >= 0 for val in eigenvalues)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
"""
|
| 238 |
]
|
| 239 |
example = examples[0]
|
|
|
|
| 234 |
|
| 235 |
# Check if all eigenvalues are non-negative
|
| 236 |
return all(val >= 0 for val in eigenvalues)
|
| 237 |
+
""",
|
| 238 |
+
"""
|
| 239 |
+
def key_exists(data, key_to_find):
|
| 240 |
+
# Base case: If data is not a dictionary, return False
|
| 241 |
+
if not isinstance(data, dict):
|
| 242 |
+
return False
|
| 243 |
+
|
| 244 |
+
# If the key is in the dictionary, return True
|
| 245 |
+
if key_to_find in data:
|
| 246 |
+
return True
|
| 247 |
+
|
| 248 |
+
# Otherwise, recurse into each nested dictionary
|
| 249 |
+
for key, value in data.items():
|
| 250 |
+
if key_exists(value, key_to_find):
|
| 251 |
+
return True
|
| 252 |
+
|
| 253 |
+
# If the key was not found in this dictionary or any sub-dictionary, return False
|
| 254 |
+
return False
|
| 255 |
"""
|
| 256 |
]
|
| 257 |
example = examples[0]
|