-
Notifications
You must be signed in to change notification settings - Fork 106
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
Move all backend-agnostic assemble_lincomb logic to algorithms.lincomb #619
Conversation
fed7530
to
cd62b56
Compare
8bf9393
to
626d1f5
Compare
c7dbc6f
to
4458151
Compare
@pmli I am now quite satisfied with the state of this PR. What do you think? |
BTW, I decided against introducing a |
One of my favourite tests fails again. >>> from pymor.basic import *
>>> I = IdentityOperator(NumpyVectorSpace(2))
>>> v = I.source.ones()
>>> (I + I).apply_inverse(v)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/pymor/src/pymor/operators/constructions.py", line 166, in apply_inverse
return super().apply_inverse(V, mu=mu, least_squares=least_squares)
File "/path/pymor/src/pymor/operators/basic.py", line 101, in apply_inverse
assembled_op = self.assemble(mu)
File "/path/pymor/src/pymor/operators/constructions.py", line 129, in assemble
name=self.name + '_assembled')
File "/path/pymor/src/pymor/algorithms/lincomb.py", line 48, in assemble_lincomb
return AssembleLincombRules(tuple(coefficients), solver_options, name).apply(tuple(operators))
File "/path/pymor/src/pymor/algorithms/rules.py", line 269, in apply
result = r.action(self, obj)
File "/path/pymor/src/pymor/algorithms/lincomb.py", line 168, in action_call_assemble_lincomb_method
op = ops_without_id[0]._assemble_lincomb(ops_without_id, self.coefficients, shift=id_coeff,
IndexError: list index out of range |
Maybe add that as an actual test in https://github.com/pymor/pymor/blob/master/src/pymortests/operators.py ? |
e455479
to
982f5bf
Compare
That issue should be fixed. Anything else? |
Technically, it looks ok to me. I'm a bit unsure about the name |
Aren't you guys usually speaking of solving shifted equation systems where you implicitly mean 'shifted by a multiple of the identity'. I have nothing against renaming the argument, but how abount 'identity_shift'? |
It can mean 'shifted by a multiple of the mass matrix' (
That also sounds good. |
Right, forgot about the mass matrix .. - I have renamed the parameter to |
This moves all
assemble_lincomb
methods for genericOperators
intopymor.algorithms.lincomb
. TheRuleTable
also takes care of eliminatingZeroOperators
. ATM, the backends still need to handleIdentitiyOperators
. Before merging, this issue should be resolved (e.g. by introducing aShiftedOperator
andapply_inverse_shifted
interface methods or a separate argument to_assemble_lincomb
).This addresses #548.