Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solver argument consistency #21

Open
bernstei opened this issue Dec 14, 2021 · 6 comments
Open

solver argument consistency #21

bernstei opened this issue Dec 14, 2021 · 6 comments

Comments

@bernstei
Copy link

bernstei commented Dec 14, 2021

It would be nice if different solvers agreed on whether multiple numerical arguments should be passed as further elements of solver[2...] or as an array entirely contained in one element of solversolver[2][...]

This is an example of the latter

rscal = solver[2][1]
while :rrqr_lap a few lines below is the former.

I guess in principle a solver might need (conceptually) a single value and an unknown (at coding time) number of values, which might best be encoded as [ val, [ subval1, subval2 ... ] ], but that doesn't actually seem to be the case so far.

@cortner
Copy link
Member

cortner commented Dec 14, 2021

I think we need a well-defined interface for different solvers. E.g.,

QR()
RRQR(tol = ...)
LSQR(tol = ..., damp = ... )
LBFGS(history = ..., tol = ... )
ADAM( .... )

and then use dispatch to call the right functions. This will make it extendable and more disciplined.

My only question is whether it is worth doing this here and now for IPFitting or whether it should be done for the rewrite.

@bernstei
Copy link
Author

In some ways that'd be even less convenient for me (namely accessibility from the command line/wrapper), but if it's more consistent, I won't complain.

@cortner
Copy link
Member

cortner commented Dec 15, 2021

The point is you can now use kwargs even from the command line or f youbwish

@bernstei
Copy link
Author

That's true for the arguments, but as you wrote it up there you have to have an if else if ... for the actual choice of function to call. I guess there's probably some version of eval() that could be used.

@cortner
Copy link
Member

cortner commented Jan 28, 2022

there is no need for if-else. We just use a bit of meta-programming + dispatch.

@bernstei
Copy link
Author

I wasn't sure - some people shy away from running arbitrary functions specified in user string input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants