|
5 | 5 |
|
6 | 6 | import h5py |
7 | 7 | import numpy as np |
8 | | -import sympy as sp |
9 | 8 | from numpy._typing import ArrayLike |
10 | 9 |
|
11 | 10 | from sasdata.quantities import units |
@@ -64,18 +63,6 @@ def matinv(a: Union["Quantity[ArrayLike]", ArrayLike]): |
64 | 63 | return np.linalg.inv(a) |
65 | 64 |
|
66 | 65 |
|
67 | | -def determinant(a: Union["Quantity[ArrayLike]", ArrayLike]): |
68 | | - """Find the determinant of an array or an array based quantity.""" |
69 | | - if isinstance(a, Quantity): |
70 | | - return DerivedQuantity( |
71 | | - value=np.linalg.det(a.value), |
72 | | - units=a.units, # TODO: hmmm, need to think about this |
73 | | - history=QuantityHistory.apply_operation(Determinant, a.history), |
74 | | - ) |
75 | | - else: |
76 | | - return np.linalg.det(a) |
77 | | - |
78 | | - |
79 | 66 | def norm_1(a: Union["Quantity[ArrayLike]", ArrayLike], axes: int | tuple[int] | None = None): |
80 | 67 | """Caculate the 1-norm of an array or an array based quantity.""" |
81 | 68 | if isinstance(a, Quantity): |
@@ -1201,22 +1188,6 @@ def __eq__(self, other): |
1201 | 1188 | return False |
1202 | 1189 |
|
1203 | 1190 |
|
1204 | | -class Determinant(UnaryOperation): |
1205 | | - """Array Determinant - backed by numpy's det method""" |
1206 | | - |
1207 | | - serialisation_name = "determinant" |
1208 | | - |
1209 | | - def evaluate(self, variables: dict[int, T]) -> T: |
1210 | | - return np.linalg.det(self.a.evaluate(variables)) |
1211 | | - |
1212 | | - def _derivative(self, hash_value: int) -> Operation: |
1213 | | - return Trace(sp.adjugate(self.a) * self.a._derivative(hash_value)) |
1214 | | - |
1215 | | - def _clean(self): |
1216 | | - clean_a = self.a._clean() |
1217 | | - return Determinant(clean_a) # Do nothing for now - can consider identity matrix and common columns |
1218 | | - |
1219 | | - |
1220 | 1191 | class Dot(BinaryOperation): |
1221 | 1192 | """Dot product - backed by numpy's dot method""" |
1222 | 1193 |
|
@@ -1280,10 +1251,6 @@ def _clean(self): |
1280 | 1251 | # Removes double inversions |
1281 | 1252 | return clean_a.a |
1282 | 1253 |
|
1283 | | - elif isinstance(clean_a, Determinant): |
1284 | | - # Inverse of determinant is determinant of inverse |
1285 | | - return Determinant(MatInv(clean_a.a)) |
1286 | | - |
1287 | 1254 | else: |
1288 | 1255 | return MatInv(clean_a) |
1289 | 1256 |
|
@@ -1451,7 +1418,6 @@ def __eq__(self, other): |
1451 | 1418 | Log, |
1452 | 1419 | Transpose, |
1453 | 1420 | Trace, |
1454 | | - Determinant, |
1455 | 1421 | Dot, |
1456 | 1422 | MatMul, |
1457 | 1423 | MatInv, |
|
0 commit comments