Skip to content

Commit

Permalink
remove cpp32 solver
Browse files Browse the repository at this point in the history
  • Loading branch information
PFLeget committed Nov 5, 2024
1 parent 3de73d0 commit 6132de0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
17 changes: 6 additions & 11 deletions piff/basis_interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def _solve_qr(self, stars, logger):
self.q += dq.reshape(self.q.shape)

def _solve_direct(self, stars, logger):
if self.solver == "cpp" or self.solver == "cpp32":
if self.solver == "cpp":
self._solve_direct_cpp(stars, logger)
else:
self._solve_direct_python(stars, logger)
Expand All @@ -302,17 +302,15 @@ def _solve_direct_cpp(self, stars, logger):
"""The implementation in C++ of solve() when use_qr = False.
"""

cpp_use_float32 = self.solver == "cpp32"

Ks = []
As = []
bs = []
for s in stars:
# Get the basis function values at this star
K = self.basis(s)
Ks.append(K if not cpp_use_float32 else K.astype(np.float32))
As.append(s.fit.A if not cpp_use_float32 else s.fit.A.astype(np.float32))
bs.append(s.fit.b if not cpp_use_float32 else s.fit.b.astype(np.float32))
Ks.append(K)
As.append(s.fit.A)
bs.append(s.fit.b)
dq = basic_solver._solve_direct_cpp(bs, As, Ks)
self.q += dq.reshape(self.q.shape)

Expand Down Expand Up @@ -463,10 +461,7 @@ class BasisPolynomial(BasisInterp):
squares solution. QR decomposition requires more memory than the default
and is somewhat slower (nearly a factor of 2); however, it is significantly
less susceptible to numerical errors from high condition matrices.
"cpp32":
Same as cpp solver but use float32, faster than cpp with a trade for accuracy,
to use carefully.
Solvers available are "scipy", "cpp", "jax", "qr", "cpp32". See above for details.
Solvers available are "scipy", "cpp", "jax", "qr". See above for details.
:param logger: A logger object for logging debug info. [default: None]
"""
_type_name = 'BasisPolynomial'
Expand Down Expand Up @@ -499,7 +494,7 @@ def __init__(

self.solver = solver

valid_solver = ["scipy", "qr", "jax", "cpp", "cpp32"]
valid_solver = ["scipy", "qr", "jax", "cpp"]

if solver not in valid_solver:
raise ValueError(f"{solver} is not a valid solver. Valid solver are {valid_solver}")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,8 @@ def test_single_image():

test_star_solver = []

solvers = ["scipy", "qr", "jax", "cpp", "cpp32"]
rtols = [1e-7, 1e-7, 1e-7, 2e-1]
solvers = ["scipy", "qr", "jax", "cpp"]
rtols = [1e-7, 1e-7, 1e-7]

for solver in solvers:
print("Running piffify function")
Expand Down

0 comments on commit 6132de0

Please sign in to comment.