Skip to content

Commit 3ca1ffd

Browse files
author
Grace Lee Rui Yue
committed
Fix determinant abbreviation discovery
1 parent 7ab1d47 commit 3ca1ffd

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/jacobian/math/matrices/_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def matrix_operation[
7979

8080
MATRIX_DETERMINANT_COMPUTE = matrix_operation(
8181
"matrix.determinant.compute",
82-
"Compute an exact rational matrix determinant",
82+
"Compute an exact rational matrix determinant (det)",
8383
"Compute the determinant of one square matrix over QQ through order 64 with SymPy's exact Bareiss algorithm.",
8484
MatrixDeterminantRequest,
8585
MatrixDeterminantResult,

src/jacobian/math/matrices/symbolic/_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def symbolic_matrix_operation[
5050
SYMBOLIC_MATRIX_OPERATIONS = (
5151
symbolic_matrix_operation(
5252
"matrix.symbolic.determinant.compute",
53-
"Compute an exact symbolic matrix determinant over QQ(t_1, ..., t_n)",
53+
"Compute an exact symbolic matrix determinant (det) over QQ(t_1, ..., t_n)",
5454
"Compute the determinant of a square matrix whose entries are rational functions in declared algebraically independent variables, using SymPy's exact fraction-free Bareiss algorithm.",
5555
SymbolicMatrixRequest,
5656
SymbolicDeterminantResult,

tests/catalog/test_search.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

3-
from jacobian.catalog.models import OperationDescriptor
3+
from jacobian.catalog.catalog import Catalog
4+
from jacobian.catalog.models import OperationDescriptor, OperationDiscoveryRequest
45
from jacobian.catalog.search import discovery_relevance
56

67

@@ -22,3 +23,12 @@ def test_discovery_phrase_matching_respects_token_boundaries() -> None:
2223

2324
assert graph_score == 0
2425
assert phrase_score >= 20
26+
27+
28+
def test_standard_det_abbreviation_ranks_determinant_operations_first() -> None:
29+
result = Catalog.open().search(OperationDiscoveryRequest(query="det", limit=3))
30+
31+
assert tuple(match.operation_id for match in result.matches[:2]) == (
32+
"matrix.determinant.compute",
33+
"matrix.symbolic.determinant.compute",
34+
)

0 commit comments

Comments
 (0)