-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
internalnorm does not work with inplace methods #569
Comments
IMO the problem is that By replacing integ = init(prob, alg = Tsit5(), abstol = 1e-6, reltol = 1e-6, internalnorm = u -> norm(u[:, 1])) successfully and to solve the ODE. An alternative approach would be that every user has to define a scalar version of |
I'd vote for fixing it instead of requiring the user to do more stuff from their side. |
I agree, my only concern was that maybe we should support changing the scalar norm used for computing the residuals as well - but I'm not sure whether this would be of any use to anyone. |
Sometimes with new number types you want define a new "norm" there for how to get a value out. That's precisely why it's used in some spots instead of scalar |
I fully agree. It seems the best way to handle this is to replace |
Added it to the DiffEq v6.0 list since that is a breaking change to how our norms work, though it was never intended at first for the norms to be doubled up like this and just a quirk of history :). |
This might cause problems for recursion, vector of vector and other types like that. I think it might be best to just update the docs to say that two dispatches are necessary. Needs discussion of course. |
What are the main problems you're worried about? The default definition of the element-wise norm could still be done in a recursive fashion, it seems to me, so it could also work for recursive types like vector of vectors. I'm wondering whether it might actually be preferable to define the element-wise norm such that |
For the vector of vector case. If it doesn't recursively reduce lower levels to scalars then the result isn't a scalar, and if the result isn't a scalar then the error estimate isn't scalar and adaptivity breaks. We still would need a few other things changed for vecvec to work without VectorOfArray wrappers, but that's at least one requirement. |
Of course, the error estimates have to be scalars, but hence the vector norm should be applied there. I was only thinking about the case of the element-wise norm in lines such as https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/blob/master/src/initdt.jl#L125 which shouldn't reduce at all I guess, since the computation of the scalar is only done in the next line https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/blob/master/src/initdt.jl#L126. |
So does this work now? Which PR fixed it? |
The docs updated. |
I assume you mean this: So this means that for the function |
yes |
MWE:
it also doesn't work If I make the equations of motion a vector (it has nothing to do with them being in matrix form)
The text was updated successfully, but these errors were encountered: