Replies: 2 comments 2 replies
-
Interesting ideas! I agree on prioritising val over jac, although I'm not entirely sure what that implies in your first suggestion? |
Beta Was this translation helpful? Give feedback.
2 replies
-
This is been resolved with the introduction of EquationSystem |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hei,
I have some ideas for the
Ad_array
class, which would simplify some algorithms (at least for me 😄 )By overloading
Ad_array.__getitem__
and
Ad_array.__getslice__
we could allow for a more unified treatment of PorePy's custom AD arays and numpy arrays, i.e.
A = Ad_array(some_vector, some_matrix)
B = A[1:10]
where the slicing would return a row-wise slicing for both value and Jacobian. It would be equivalent to
B = Ad_array(some_vector[1:10], some_matrix[1:10])
This is motivated by the fact that PorePy's AD framework vectorizes the DOFs, so row-wise slicing would be DOF-wise slicing.
I am sure this was already discussed at some point, but again motivated by simpler, unified treatment, it would be nice to have logical comparison.
It seems natural to me to provide a comparison for the values of an Ad_array.
A < B
would be thenA.val < B.val
.Why
This would remove many type checks and if clauses in the code, making code compatible for both numpy arrays and Ad_array instances as arguments.
I think its justified to give the
val
priority overjac
in both suggestions, considering thatvals
is the numerical representation of whatever quantitiy theAd_array
represents, andjac
is kind of "secondary" (if I may say so).Beta Was this translation helpful? Give feedback.
All reactions